About $variables, $hook,...
By: Arshad
25 Mar 2010From my handbook page on d.o
This little code snippet will add the present page title to the breadcrumb. We show you how to use this in steps.
Step 1 : If you do not have a template.php file in your sites/all/themes/yourtheme/ folder, create one.
Step 2 : Copy and paste this code in the template.php file.
By: Arshad
21 Mar 2010Most of us have more than many functions in our template.php file. Hooks and preprocess function to make our site look as good as the designer did it. In many cases where a site requires advanced theming,the template.php file gets huge. To keep a structured and clean coding style consider using file includes. This way you can have codes in seperate php files loaded into template.php during execution.
This is a very similar approach to how Drupal core calls files from the "includes" folder.
Here's the code to include files :
By: Arshad
20 Mar 2010How many times do we use a quick print_r to see what's in $node or $result or anything else? When coding modules , it's not very easy to output data structures to the screen unless you do a print_r($node) and view the source code. or do it like this :
[php]<pre><?php print_r($node); ?></pre>[/php]
Here's a clean and simple way you can output such data on screen. If you have the developer module enable (devel), use the dsm() (drupal_set_message) function.
By: Arshad
19 Mar 2010I'll go directly to the code
This one goes in your template.php (under sites/all/themes/yourtheme/).
function phptemplate_menu_item_link($link) { } $link['localized_options']['attributes']['class'] = 'menu-'. $link['mlid']; } else { $link['localized_options']['attributes']['class'] .= ' menu-'. $link['mlid']; } return l($link['title'], $link['href'], $link['localized_options']); }
Hello I'm Arshad. I'm a 21 years old Drupal Web Developer. This is a site i put up for some reasons i can't remember and this is where i write stuffs i need to remember.;)
In the Web world, i head the Drupal Mauritius User Group and the jQuery user Group Mauritius and i'm a campus representative for Mozilla Firefox.