I've been messing with phptemplate the last few days. I'm wondering if there's a way I can set up conditionals in the PHP so I can display different things (text or images) depending on the node.
An example:
In page.tpl.php, the following code is responsible for inclusion of the node title:
<h2 class="content-title"><?php print $title ?></h2>
Let's say I have a category called "Music" and a recent post in that category with the title "New CD from Sloan." In the stock phptemplate package, the $title variable represents the name of a category ("Music") on the category page and the title of a post ("New CD from Sloan") in the blog entry.
Category and entry title are two very different types of information, so I want a way to signal to my users that though the node title at each URL occupies the same space on the page and shares the same style, that it signifies something very different in each case.
Thus, I want to help orient my site visitors by prepending a label for the $title variable. That is, I want to display "Category: Music" on the category page and "Entry title: New CD from Sloan" on the blog entry page. (Nevermind, for now, the awkwardness of prepending "Entry title"...)
So, I need a conditional that will test whether the user is looking at the taxonomy or a blog entry, right? Something vaguely like this:
<h2 class="content-title"><?php if ($node == "taxonomy"): ?>Category:<?php endif; ?><?php if ($node == "blog"): ?>Entry title:<?php endif; ?> <?php print $title ?></h2>
That's not intended to be an example of working code... just an illustration of the kind of thing I'd like to accomplish.
My question is, what would the working code be? I'm reading things in various posts at Drupal.org and elsewhere on the web that there is a way to differentiate node types in this way, but mostly what I've read has been in reference to the xtemplate system, not phptemplate. The latter is much younger, of course, so that might explain the lack of documented answers to this question?