changing banner based on category

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
Guest

changing banner based on category

Post by Guest » Fri Sep 02, 2005 4:05 am

Is there a way to change the banner depending on which category you are in? (ex: if I have cats, dogs, etc for my categories, I have an image of a cat for my cats category, and dog for my dogs category)

TIA

Col. Kurtz
Regular
Posts: 450
Joined: Thu May 26, 2005 10:43 am
Location: Bonn, Germany
Contact:

Post by Col. Kurtz » Fri Sep 02, 2005 10:42 am

in version 0.9 (under development) you can use a plugin to change the template for every category. you could just use different headers if you want to.
you can try it, using the latest nightly built here. While under development, its running stable.
The plugin is "categorytemplates". read more about it here and theres a new version of the plugin, read more here

I dont know if theres another way. There might be.
Marc

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Fri Sep 02, 2005 12:50 pm

Whil what Col. Kurz explained is perfectly right (thanks), there also is a way to make this special banner-only change work in Serendipity 0.8

Take your index.tpl template and locate this code:

Code: Select all

<div id="serendipity_banner">
    <h1><a class="homelink1" href="{$serendipityBaseURL}">{$head_title|@default
    <h2><a class="homelink2" href="{$serendipityBaseURL}">{$head_subtitle|@defa
</div>


change this to:

Code: Select all

<div id="serendipity_banner{$categoryid}">
    <h1><a class="homelink1" href="{$serendipityBaseURL}">{$head_title|@default
    <h2><a class="homelink2" href="{$serendipityBaseURL}">{$head_subtitle|@defa
</div>


Then create a file "config.inc.php" inside your template directory with this content:

Code: Select all

<?php
$serendipity['smarty']->assign('categoryid', $serendipity['GET']['category']);
?>


Third and last, edit your style.css file and locate the "#serendipity_banner" snippet. Now copy that to "#serendipity_banner1", "#serendipity_banner2" and so on, for each categoryid and change the Image/Style for that.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply