Page 1 of 1

changing banner based on category

Posted: Fri Sep 02, 2005 4:05 am
by Guest
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)


Posted: Fri Sep 02, 2005 10:42 am
by Col. Kurtz
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.

Posted: Fri Sep 02, 2005 12:50 pm
by garvinhicking
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

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

Then create a file "" inside your template directory with this content:

Code: Select all

$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.