Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged drupal



I have to migrate from my old Drupal 5 site, that had multiple authors assigned to one node, and this is the solution for __Drupal 7__. First of all you will need to download [__References__](http://drupal.org/project/references) module and ena...
1 1086 posted 14 years ago by Turek
0 811 posted 14 years ago by JohnnyGamba
Render the contents for a single node field.
0 758 posted 14 years ago by jonathanpglick
This code goes directly into your template.php file after you remove the open and close PHP tags at the beginning and end. Then place the call below in your block.tpl.php. Don't forget to flush cache.
0 1152 posted 14 years ago by Onfire60
Copy the first code snippet to your theme's template.php. Then call the following section in you block template file.
0 1021 posted 14 years ago by Onfire60
0 843 posted 14 years ago by hamsterbacke82
Drupal 5. Simply print <code>$uc\_cart\_shopping\_block</code> where ever you want.
0 822 posted 14 years ago by resting
This snippet saves in the $return array all the names of the fields that a content type has added with CCK, has to be installed the cck module.
0 1749 posted 14 years ago by JohnnyGamba
0 812 posted 14 years ago by karmacode
Add block in anywhere in the content, node in drupal
2 919 posted 14 years ago by jesudasjj
0 936 posted 14 years ago by focal55
Put in /sites/default/settings.php
0 981 posted 14 years ago by resting
1 1002 posted 14 years ago by focal55
Automatically add a class to the body tag on each page. Remember to add <?php> to your body tag in the page.tpl.php file. You can also override or insert PHPTemplate variables into the templates with this function.
1 951 posted 14 years ago by focal55
0 817 posted 14 years ago by focal55
When adding a link to a form say for instance a login form you can use drupal_get_destination() to return the user to the page they were on when they finish loging in. This show you how to do this programatically in a link l(); function.
0 1047 posted 14 years ago by Onfire60
Adjust the size of the body field window. For use in hook_form_alter().
0 996 posted 14 years ago by tgbdad
Only this portion needed // Add page template suggestions based on node type, if we aren't editing the node. if ($vars['node'] && arg(2) != 'edit') { $vars['template_files'][] = 'page-nodetype-'. $vars['node']->type;...
1 1031 posted 14 years ago by resting