10 useful Drupal tips
Time for some random Drupal tips and tricks. Some of these are very straightforward and if you are someone who allways reads all documentation you should probably know most of them, but hey! Who reads manuals? 😉 Anyway here are 10 random Drupal tips I got from first hand experience.
1. Removing the body field
Whenever you create a content-type a body field is automatically created. If you simply don’t need it or don’t want it (because you create a custom one with CCK for example), you can remove it by simply editting the content type and erase the label ‘Body’. Using a blank label will remove the field.
2. Using different page templates depending on the current path
Standard Drupal feature. For example, create a page-front.tpl.php for a custom frontpage.
3. Display categories
You can use this snippet If you want to display a list of categories quick and easy (and don’t want to use some module like taxonomy_menu)
4. Install DHTML menu for your Garland admin theme
If you use Garland (like many people) as your admin theme, don’t forget to install DHTML menu. It will put a smile on your face. Promise.
5. Drupal default input filters by content-type
Though it is still in development I really like this module. Using it you can give each content-type a default input-type. This way an admin won’t have to manually switch to the desired filter type (e.g. full html) each time a node is created. Which is common because you probably want the admin to have more privileges than an anonymous user, but the default input type is allways available for all roles – thus forcing an admin to manually have to switch in such situation. An annoying task which is easily overlooked.
6. Howto get rid of the my account menu
This one was also mentioned in the top 50 Drupal tips: Move the “My Account” menu item by creating a custom menu item at ‘user’.
7. Drupal active menu-item trail
A very common setup is to have a vertical submenu (for example in the left sidebar) and a horizontal main-menu (in the header). In the default setup you lose the active, parent menu item if you are at one of the subitems. If you want to easily show your active parent items through CSS you can use this method.
8. Multi-language and SEO
Drupal can easily handle a multilingual site, but there are some things you should consider when using i18n and Search Engine Optimization.
9. Removing subject in comment form (theming forms)
If you want to mimic WordPress commenting-style by removing the subject field in a comment form, do it the right way. (not by setting display:none in css) However, theming forms is a bit different from theming other stuff in Drupal.
10. One problem many solutions
Finally, most problems can be solved in Drupal in different ways. For example: image galleries in Drupal (dutch post). Make sure you do the right research before you start building! While many challenges can be taken care of using the right mix of modules – there are situations when writing your own Drupal module is necessary.