Header Images Per Category (again!)

By | August 28, 2008

Ryan says;

I want to have header images display per category, how can I do this. I already have made a script buts its really repetitive.

The code Ryan had come up with was really quite complicated, repetitive and pointless. My idea is like this:


We know that the function called tep_image is used to pick out an image grab the alt text and display it, so we can use this along with the switch (based on current_category_id) to show the relevant image.

The current_category_id is used in FILENAME_DEFAULT (usually index.php) and shows the category ID of the category you are currently in – surprising that it is called current_category_id wouldn’t you say 😉

The above code is off the top of my head and is actually untested, so if anyone does try it and it goes wrong, let me know and I’ll amend this post.

For reference, see http://uk.php.net/switch for more details on switching.

Leave a Reply

Your email address will not be published.