Category images or banners

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Category images or banners

Post by hdiaz36 » Wed Mar 10, 2010 12:03 am

I've been trying to get a different banner for each individual category, but I cannot seem to get this to work properly.

If I go to a category and I enter an image, it doesn't change the banner, but will simply add another image below the banner. To make thing worse is that the category image will fall behind any images at the top of an entry.

Is there an easy way to have a different banner for each category?

If I remember correctly, I previously modified the index.tpl of my theme and that is how I got a new banner, but what I'm actually trying to achieve is a new banner for each category.

Hope everything I've written makes sense.

I'll attach some screen shots for the sake of clarity.

In this I have already changed the banner.
Image


Here I have tried to add an image for the category, but the end result is nowhere near what I desired. :(
Image

User avatar
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Category images or banners

Post by yellowled » Wed Mar 10, 2010 11:20 am

hdiaz36 wrote:If I go to a category and I enter an image, it doesn't change the banner

That's meant to be used for a category icon actually. Something to indicate the category of an entry visually, usually within the entry.

hdiaz36 wrote:Is there an easy way to have a different banner for each category?

Phew, define "easy".

We have the event plugin "Properties/Templates of categories" which makes it possible to assign different templates to a category. You could assign the same template to each category, but with a different banner. This would be much easier if your template supports a header image from the media db, which I take it is not the case right now?

My personal experience with this plugin is that it is kind of complicated to use and prone to error. Everyone's mileage may vary.

You could also hack your template to use different banner images for various categories, but that is kind of difficult to implement, I guess.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

Re: Category images or banners

Post by garvinhicking » Wed Mar 10, 2010 1:49 pm

Hi!

Maybe the easiest way is inside your index.tpl:


Code: Select all

<div class="serendipity_banner{$category}">


on the banner, and then use CSS to create a class for serendipity_banner1, serendipity_banner4 etc. (the number corresponds to the number of your category).

HTH,
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/

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Category images or banners

Post by Don Chambers » Wed Mar 10, 2010 4:19 pm

Hey, that's a pretty cleaver idea Garvin! :wink:

Post Reply