template.php is the file in a theme folder which contains the functions used by the theme's template files, and the theme functions called by Drupal.
0
votes
3answers
50 views
Edit Node Title in Template.php
UPDATE: I know that I could accomplish this inside of a tpl.php file. But I would prefer to keep as much logic in the template.php file as possible, reserving tpl.php adjustments for markup. I have ...
1
vote
2answers
28 views
Display a block on some pages according to the fields content of that page
I created a content type called people, where I create personal pages using that type. One of the fields is 'area'.
Then, I created a view of block called 'software people', where I list all the ...
1
vote
2answers
30 views
function theme_field__content_type() isn't working
I'm trying to modify all fields output for a specific content-type called Netrunner-Card.
After digging through Stack Exchange I ran across someone that suggested using:
function ...
0
votes
2answers
39 views
Adding html to t() in Drupal 6 template.php?
Hi I am trying to add html to the "t('Older Posts')" and "t('Newer Posts')" Is this possible ? I can figure it out ????
I am in a Drupal 6 template.php file.
This is the code I am trying to add as ...
1
vote
1answer
25 views
How to tell if the current language is written RTL or LTR
I'm looking for the function – if that exists – for asking Drupal about the current language direction (RTL/LTR).
I check the global language variable but it doesn't contain that ...
0
votes
3answers
86 views
Preprocess function for node.tpl.php file
I've watched a million videos and read a million tutorials trying to figure out how to create a new variable for use in a version of a node.tpl.php file by utilizing preprocessing functions, but can't ...
2
votes
2answers
43 views
Including template footer.tpl.php within another template page.tpl.php
I am looking for simple way to include footer.tpl.php that is just html block into another template like page.tpl.php. In Grails/Groovy that is as simple as
<g:render template="side_menu"/>
...
0
votes
1answer
25 views
How to add css to a form according to the user's role?
I know how to add css to individual form types using:
function theme_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'formtype_form':
global $theme;
...
0
votes
1answer
33 views
How to rewrite the value of an array element in page.tpl.php
I'm totally new to PHP programming and modifying the values of Drupal output with php customisations, so sorry if this question seems dumb.
In Drupal 6 I need to rewrite the value of the array ...
1
vote
1answer
17 views
How to load conditionally a script depending on whether element exists in DOM?
I have a Drupal.behaviors.leftmenusticky script that converts a left menu to a sticky menu (100% height,position fixed and the like) but I want to drupal_add_js it only if the menu actually exists in ...
0
votes
0answers
19 views
Language switcher with custom dummy link (Drupal 7)
I have site with cyrillic text and I would like to add custom link which will transliterate current page to latin.
Transliteration itself is not a problem, I can accomplish that with ...
0
votes
1answer
18 views
Node Teaser Acting like Full Node
I have got a problem. I have been upgrading my site from Drupal 6 to 7 and I've reached about 75% of the way. I have updated all my 3rd party modules and custom modules and while I was configuring ...
0
votes
0answers
15 views
Override contributed module output (inline links)
I've installed the Drupal 7 port of the Node to Word module for exporting nodes as word or txt documents. The module packs two links - "Save as Word" and "Save as Text" - into the $content['links'] ...
2
votes
1answer
39 views
How to add classes to h2 block title tags in sidebar region
I need to add a class to the h2 block titles in a sidebar. How can I do this in pre-process? I haven't been able to find an example that shows how to isolate certain blocks. I'm using Omega.
0
votes
1answer
23 views
Login Users action in, $action_links, how do i edit it?
I am still very new to drupal and have let to use all the hooks and coding needed to do everything, now I have come up with a problem, which I can not seem to fix either with a module or by looking at ...
0
votes
0answers
17 views
How can I combine the output of two seaparate fields in template.php?
I have two fields displaying multiple values from select lists. The first field's a term reference field, the second's a text list. So,
print render($content['field_term_list']) produces
Term1
...
1
vote
1answer
47 views
Add html class to body
I've got a block created with views, which displaying a slider.
The slider is created as an unpublished content type with two field collections:
Settings[one value]:
selectors type: thumbs or ...
1
vote
1answer
42 views
How do I specify an image style in my preprocess function?
In my current project, whenever a node's image field is empty, I'm filling it with the image from an entity referenced in the node. To pull this off, I'm using this magical piece of code in ...
0
votes
0answers
19 views
Using theme_links to add classes to the list-items
I am using theme_links in my template.php to render something,
function paddle_admin_preprocess_page(&$variables) {
$variables['toolbar_menu'] = theme('links__system_secondary_menu',
...
0
votes
3answers
37 views
listing all the pages of a custom content type
I would like to know the appropriate way to listing the contents in a single page of type "news". Let me clear it once again, I have a "news" type custom content type.
Now i want to list all the ...
0
votes
2answers
26 views
How to transfer data from views-view-fields.tpl to views-view-unformatted.tpl in D7?
I need to collect some data within views-view-fields.tpl, and then transfer it to views-view-unformatted.tpl to do some magic to the whole data-object. How could I do that? Thnx!
0
votes
1answer
40 views
Unable to remove #main-content block from the front page
I'm having an issue with removing the #main-content block from my front page in adaptivetheme.
First here is a list of what I've tried so far:
Under 'Blocks' choosing to show the block only on ...
0
votes
1answer
51 views
Theme taxonomy term page with template override
I know this is far from duplicate but im a bit stupid.
I am trying to theme the terms page for each term for a specific vocabulary i created.
I 've used path auto when i was creating the terms so i ...
1
vote
1answer
25 views
Modify instead of add a class in classes_array for theming purposes
I am using the following preprocess in my template.php
function paddle_admin_preprocess_menu_block_wrapper(&$variables) {
if ($variables['delta'] === 'management_level_2') {
...
0
votes
1answer
43 views
Page template for custom form
I'm trying to create a new page template for a custom form I'm building in my module. My goal is to use create something like a new page.tpl.php for this specific form and it looks like this method is ...
0
votes
0answers
17 views
Get service links in Ubercart product node rendered programatically
Service links module suggests this approach when rendering service links programatically, and I am using this approach to have granular control on each service link segment. It works for any other ...
0
votes
1answer
71 views
How to override webform in template.php
I've followed different tutorials but I cannot seem to override a field on my webform via a function in template.php.
Theme is called: 'myTheme' Id of the form is:
'webform_client_form_76' Id of ...
0
votes
0answers
75 views
Populating the $variables['classes-array'] in preprocess_html function
It seems most likely that the following code is not working due to bad php but I just can't understand why. If I var_dump $variables['classes'] it returns that it is an array with the classes listed ...
1
vote
1answer
29 views
Adding JS to a specific URL
I want to add some JS to a particular page. In template.php, do I simply need to check request_path() in my preprocess_page() function in template.php? Is that the best way to do it?
0
votes
0answers
20 views
Drupal 6 theme individual mini pagers
I was able to theme the mini pager by taking pieces of the code from views module file and adding in some useful php to manipulate it. problem is that i need to individualize the setting so i dont ...
0
votes
1answer
27 views
theme_username($object) in Drupal 7?
In my author_pane template, I get my user´s names trimmed as it was back then in Drupal 6.
So I went to the api page (as I did in my D6 installation) and I see that the code that used to work in ...
0
votes
1answer
46 views
Is it possible customize user login page on Adaptive Theme?
I tried many solutions for change my mysite.com/user page. I want, only login-register-forgotten form is visible, other block hidden. But what i try a solution, don't working.
Is it possible? How can ...
0
votes
1answer
52 views
Creating a Home Page Template
The index page of a site I am building is to be a video and nothing else which clicks through to the site.
I have read about page templates and seen some modules called 'front page' but I would like ...
2
votes
2answers
96 views
How to include a custom menu in page.tpl
I want to code a custom menu straight into page.tpl.php. The default theme uses
<?php if ($main_menu): ?>
<div id="main-menu" class="navigation">
<?php print ...
1
vote
1answer
66 views
Including files in template.php. failed in some cases (when using some contrib modules)
In template.php, in theme__preprocess_page function, I am including files (as my template.php grew big, I decided to separate some operations for readability) like this:
function ...
0
votes
0answers
44 views
Error when creating a custom page in D7
I want a new and custom user login page. So, put this code in my template.php:
function mythemename_theme() {
$items = array();
// create custom user-login.tpl.php
$items['user_login'] = array(
...
0
votes
0answers
34 views
Function declared in template.php doesnt get loaded in a page's content
I have created a function called generate_rss(), but when I call that function inside a page using PHP code as input format, I get the following error message:
Fatal error: Call to undefined ...
0
votes
2answers
61 views
Print selected fields from a referenced node
Using entity reference, i have been able to link a node of type blog to another node of my custom content type, "challenge", by creating a field under blog of type entity reference. Great. Now, when ...
1
vote
2answers
70 views
Display node author picture through tpl file
I am writing my custom node--blog.tpl.php for my Drupal7 based site. I want to print the author image of the blog so in my tpl file i include the following:
$user = user_load($user->uid);
print ...
0
votes
1answer
61 views
Added some function to theme's template.php and got WSOD (White screen of death) How to restore? [closed]
Yeah so here's the deal. Using D7 with Omega theme. And I added some function to the template.php of my child theme, cleared the cache and BAM! WSOD. I restored my template.php to its original, but ...
1
vote
2answers
131 views
Customize the user-edit page
I want to customize the user-edit page. So in my template.php in my custom theme i direct Drupal to look for my custom template as:
function mytheme_theme() {
return array(
// The form ID
...
0
votes
0answers
57 views
How to get thumbnail location for video in preprocess
I am trying to populate the thumbnail generated for a Video on the actual Video node page along with the video itself. I assume best way to do this is get the thumb location in preprocess and then ...
0
votes
1answer
31 views
Modify a Module's output from a theme
I'm really pulling my hair out about this one and wonder if someone can help?
Is it possible to override a module's output from the theme's template.php file?
Basically, I wan't to modify the output ...
0
votes
1answer
39 views
How to override the menu_tree without affecting the admin menus
I've worked out how to override the menu_tree function by using this code in template.php :
function myTheme_menu_tree($variables) {
return '<nav class="menu">' . $variables['tree'] . ...
0
votes
1answer
135 views
How to theme “My Results” (quiz module) tab that´s inside the user´s profile?
I´m using quiz module in Drupal 7, and need to theme the output in "My Results" (wich is a tab in the user profile page).
Here´s the module´s function :
// THEME FUNCTIONS
/**
* Theme the user ...
0
votes
1answer
62 views
template_preprocess_html(&$vars) dynamic code
I have an html template variable called "sitepage" that needs to be set by a module based on node relationships.
Is there a way to set html.tpl variables from a module?
function ...
0
votes
0answers
81 views
How to only display languages in language switcher block where a translation exists?
I need to enable thousands of languages on my Drupal 7 site, but I do not want to incur the rendering overhead of creating the language switcher sidebar for every language. The default behavior for ...
0
votes
1answer
24 views
Where to put formatting
I am building a custom module to grab data from an XML feed, however some of the data comes in badly formatted and I would like to change some of it around (for example put line breaks after certain ...
0
votes
1answer
119 views
Custom jQuery scroll
I'm new to drupal 7 and I'm having issues getting the smooth div scroll to work. What I'm going for is this! I also need it to be on every page of the site.
I downloaded the Zip file which is ...
0
votes
1answer
38 views
This page was last modified on 1 January 1970
Including the following code:
<?php print 'This page was last modified on ' . date('j F Y', $node->changed);?>
in node.tpl.php displays the correct information on the site. However, I ...


