Language
  • English
  • Français
Drupal custom theming or module development price estimate calculator

Drupal Tutorials : Drupal Theming

drupal tutorials Welcome to my Drupal Tutorial listing. I have tried to make the tutorials as easy to find as possible by categorizing them by skill level and by the three major areas of Drupal development: Drupal Administration, Drupal Theming, and Drupal Module Development. If you are not able to find the information you are looking for feel free to post a Drupal question and I will do my best to answer it. (Note: you must login or register with this site in order to post content.)

How to turn off Vertical Tabs for a specific content type

I rarely do any heavy structural changes to node edit pages, so until today I hadn't ever had a reason to disable vertical tabs on a specific content type, but there's a first time for everything.

Now there are people who recommend turning it off by editing the $conf variable in the settings.php file... however, this is not an option on this particular site since it is running on Aegir, which automatically rewrites the settings.php file. So I had to find another way. I took a look at the vertical tabs code and came up with an easy solution.

CCK create automatically updating year select field

When you want to create a list of years as a select field in CCK ranging from some set date in the past to the current date you have a couple of options. The first option would be to go through and manually enter every year from that date to present. This may be ok if you only are working with a date range of 3 or 4 years, but what if you want to list the years since the 1800s. Obviously that list would be painful to make, and what's worse you would have to make sure the site was updated every year by someone competent enough not to destroy the information.

How to create a custom template file for a form with Zen subthemes

There are two stages of understanding needed in order to create a template file for a form in a Zen subtheme. The first level in my opinion is to understand how to achieve that same result in a normal theme.

In a normal theme all we need to know in order to create a working tpl (template file) for a form is the form id in question and the format to connect that form to the tpl from within the template.php file.

How to programmatically insert a view into a tpl or content in Drupal 6

In Drupal 6 views has been completely rewritten from the ground up, and as such we have to adjust the little code snippets that we developers have collected over the years to compensate.

The old way ( Drupal 5 views 1 ) of inserting a view into a tpl or into a php enabled content area was as follows:

<?php
$view_name = 'text_listing'; //name of view
$view_args = array($oldstring) ;
$view = views_get_view($view_name);
print views_build_view('embed', $view, $view_args, $view->use_pager, $view->nodes_per_page);
?>

This has now changed to the following:

<?php
  $view_args = array();
  $display_id = 'page_1';
  $view = views_get_view('logo_slideshow');
       if (!empty($view)) {
        print $view->execute_display($display_id , $view_args);
  }
?>

How to insert a block into a tpl or into content programmatically with Drupal

There are several ways to insert blocks onto a page with Drupal. You can use panels, you can add a region to the theme, or you can call the blocks programmatically with php. Though it might not seem evident at first there are some situations where it really is much easier, or better just to call a block with php rather than using the other options. One good example is where you want to add a particular block to a page that shows up in an odd location (such as the top right hand corner of the page) where panels can’t get to.

How to theme specific blocks in Drupal

Drupal blocks can be themed on several levels. You can create a custom html layout for all the blocks on your site, you can create a different layout for a specific region on your site, you can customize the blocks according to the module that created the blocks, or you can even theme an individual block with its own unique html and corresponding CSS styles.

How to theme the search form for Drupal 6

Drupal is made to be customized; however some parts of Drupal theming don’t have much documentation written about them. Theming the search form is a good example. I don’t know if someone has added a tutorial in the last couple of months, but when I made the switch from Drupal 5 to Drupal 6 I couldn’t find a tutorial anywhere that explained how to do it, and the function that I had used for Drupal 5 was no longer working. So I tinkered with it a little, and after a bit of trial and error I came up with a method that works.

Ask a question related to Drupal development or administration