Hi There,
I'm creating an Acquia Marina sub-theme (will post to the group when finished) - I'm a little nervous when it comes to tweaking the template.php, but can anyone suggest a quick and simple way to print the page title in the body class? Like the way Zen Theme does. I'm wanting to have a different background image in the header of each page in primary links.
Brock
Comments
Comment #1
jwolf commentedIf I understand you correctly, you want an unique identifier for each page?
You can customize template.php, adding to function phptemplate_preprocess_page(), which adds a body_id to the
<body>that will grab the current page's URL. In other words, give<body>tag a unique id depending on page path:Then you can add the
$body_idvariable to the<body>as follows:The following example is directed towards node/34
Within style.css you can target just the page that you want to add additional styles for just the node/34 page:
Comment #3
gintass commentedSuggested code didn't work in my case since I wanted to apply unique CSS to a view with the pager. Pager would add an extra stuff to body ID. For example first page in this view would have id="page_publications" but the page 2 would have an id="page_publications?page=2" Since I wanted all pages in this view to have the same ID I modified the code above by using preg_replace instead of str_replace. This is because with preg_replace I could use regular expressions and remove '?page=1', '?page=2' etc. from body ID.
Comment #4
sokrplare commentedRan into some issues - I think because we're using Clean URLs where the code in #3 wouldn't work, but jwolf's code in #1 worked like a charm - thanks!