path to call CSS for new template file (sorry me again..)

public
Gerben - Tue, 2008-08-12 13:11

I created a new template file called "page-taxonomy-term.tpl.php", based on the node.tpl.php. The idea is to create a different look for taxonomy term pages. As it turns out the new template file is not associated with any CSS sheet. After looking in the forums I realised I need to call the CSS correctly. Normally this is done by inputting

<?php
print $styles;
?>

This partly solves the look of the taxonomy term pages but not completely: header and sidebars and footer are gone and only the content of the age itself is displayed. I have been trying to insert various other peaces of code (like

<?php
print $header;
?>
) to no avail. I assume I am overlooking something simple but cannot find it.

Does it have to do with the fact that Zen theme does not have a default style.css so I need to add something?

Many thanks,
Gerben

hm.... you mean you created

heather's picture
heather - Thu, 2008-08-14 08:02

hm....

you mean you created a page-...php.tpl based on copying the code from node.php.tpl... and not copying the code from the the page.php.tpl inside the zen folder? that may be the source of your woes.

  1. open up the zen/page.tpl.php - copy all its contents
  2. open your first attempt - page-taxonomy-term.tpl.php and paste in all the code from step 1
    • maybe you want to make note of changes you previously made to the display... and save them
    • at this point, put in a test message to make sure it is working. like <h1>OMG THIS IS THE TAXONOMY TEMPLATE</h1>- outside of the <?php ...?> tags
  3. save & upload
  4. empty cache and view results.

does that help?


Thanks again for the

Gerben - Thu, 2008-08-14 18:07

Thanks again for the reply!

You are right, the new template file should be based on the page.tpl.php and not the node.tpl.php. I played around with this for a while: one problem with manipulating the template file is that the

<?php
print $content;
?>
line needs to be changed and broken down into the individual fields one would want to output. This can be done but it really means a lot of work if not versed in php...

However, this issue is related to my other question here http://groups.drupal.org/node/13891. It can be solved with the Views Module without a need to manipulate template files.

Sorry for asking all these questions in the last days. One of the confusing things about Drupal (for a beginner) is that there are sometimes different paths to desired Walhalla and it's all a bit confusing.. ur..

All best,
Gerben

Just wanted to add

dellintosh's picture
dellintosh - Tue, 2008-10-28 07:59

Just wanted to add something, which since this is an older post you probably discovered: the

<?php
print $content;
?>
is generally handled in the node.tpl.php files, so node-forum.tpl.php handles the display of the forum content, node-blog.tpl.php handles the display of the blog content, and so on.

By editing those files (copy/paste from the node.tpl.php file to start), you can fully control the output on a programmatic level. Obviously Views is a very powerful tool as well, and can do many of the things you want to do, but thought I'd mention the above to help you or anyone else out if they are struggling to edit that elusive print $content;

Hope that helps someone out!
-dellintosh