Hi,
I have read through the current drupal theme handbook (just looked at 6) but am still not really clear on the whole process. Have worked with drupal for quite a while, mainly from an 'admin' perspective and would like to delve into theming more.
I thought the best way to understand the process is to do a theme from scratch. I have a style sheet, .info file and a page.tpl.php. Enabled my theme at user interface. My first question is where is the remainder of the html coming from. I can see the divs that I inserted into my page.tpl.php page, but there are several more (as evident from the source code) and where is the document type definition sent from.
I understand where the other style rules are coming from and how, checking through firebug, I can see each system module that has the style sheet associated with it.
In the template page I created, I specified just the most basic php to fill the page with dynamic content. However the order of the divs, with php inserted, is different on the page when it is served up. The header div is coming before the container div, where as in my page.tpl.php I put the container div first, then header div. What makes these swap around and why?
Sorry if this is at such a basic level. it is probably asking to sum drupal up in far to simplistic a way, but need to start somewhere to move forward!
many thanks if you can assist.
Comments
Personally, I think starting
Personally, I think starting from scratch is not the easiest or best way to understand theming. It can be your ultimate goal, but IMHO you're making the learning curve steeper than necessary. I would advice you to start looking at an existing theme (Garland is fine) and see what's in there. Start experimenting with the page.tpl.php (html structure of your page) and css (styling) and see what happens. After that, dig into files like node.tpl.php (change the html structure of a node), the .info file (add a region, add javascript) and template.php (manipulate variables, add theme overrides).
Clear the cache
Try clearing the cache. Drupal stores information about your theme and the .tpl.php files it has and the functions it uses in a registry in the cache. So, try that first.
Go to admin/settings/performance and click Clear cached data (near the bottom of the page).
You can install the devel module and enable the Development block. This gives you a handy link to clear the cache and other functions.
You can also make an extra file in your theme called template.php and add the following to it:
This clears the theme registry on every page load. So, useful when developing your theme, but make sure you remove it when you go live!
There are various .tpl.php files dotted around the system that are generating the HTML for you. You can copy these into your theme to make changes to them. There are also theme functions, which always start with theme_
Copy any of these into your template.php file to make changes. You have to rename them by replacing theme_ with yourthemename_
Then there's preprocess functions... but one thing at a time, eh? ;)
thanks both for your
thanks both for your replies,
I have just downloaded the E-book by packt publishing on drupal theming for 6 - this looks like it has the overview and big picture that i am looking for. There really is a lot involved in theming - I just hope that D7 will not present any more changes in this area.
BTW - I had already cleared the cache under performance and had the theme registry set to rebuild on each page load (the zen theme provides a toggle on and off button for this feature) so still not quite sure re the order of my divs in page.tpl.php - but will get to the bottom of it all I hope.
Cheers,
Renaee.