I am an experienced web developer, but i've managed to make it 10 years until today without developing for or looking into drupal. A few hours into it and I am not finding the documentation for what seem like the most basic of theming questions.

I'm sure this has been asked and answered 100 times, but I have read the theming guide many times and read through the forums....

1. specify your theme's options/settings in your theme's .info file.... ok, fine!
regions[dash] = Top dashbar section
regions[header] = Header
regions[content] = Main content area
regions[search] = Search sidebar
regions[sidebar] = Right sidebar
regions[footer] = Footer

2. copy into my theme directory html.tpl.php (highest level template to override) and page.tpl.php, and customize them.... ok done, awesome.

referencing a different theme's page.tpl.php, i add " print render($page['content']); " to my main content area of my layout.

I add my custom css file.

i can already preview my drupal site and it looks more or less like the static html theme i was starting with, with dynamic drupal entries being loaded into the area i defined as "content", so thats promising.

3. So I go out on a limb and create search.tpl.php and sidebar.tpl.php in my directory, and in the relevant areas of my page.tpl.php i add " print render($page['search']); " and " print render($page['sidebar']); "
hoping between this and the .info, drupal will know to use these templates for these areas. this does not work.

this is where the question lies, how do you link up the stated regions in the info file with an arbitrary template file?
The theming guide goes on about how the inheritance works, and i think i get that, but i can find hardly any information at all about how you make these template files pulled in dynamically, from scratch.
I just want to define the regions in my page.tpl.php that should pull in other template files.

Comments

Andy Britton’s picture

Rather than go off on a tangent I have a question:

Why do you want to make template files for these regions?

goddestroyer’s picture

I thought that was the name of the game. Like I said, this is my second day looking at drupal now. any advice falls on welcome ears.

Andy Britton’s picture

I've just answered a similar question here http://drupal.org/node/1058304

The regions your specifying in your page.tpl.php and info file are for assigning content to, mainly nodes(pages) and blocks that are generated by contributed modules, Drupal core or are of your own creation; all done in Drupals administration.

Normally you only use template files if you want to overide the default system code to alter the way it is displayed. If you just want to assign content to these regions to start with have a look at the post I linked above and ask if you have any further questions.

Andy

goddestroyer’s picture

Thank you, I have just figured that part out. I was thinking that the individual template files would be needed to define which blocks to use in code, but now i see there is a GUI for all of that in drupal, and all i need to put down is the print render($page['regionName']); in my page template wherever i want blocks assigned to that region to appear.