Does anyone have a suggestion as to select a different header image per category.
To be clear...
Real Estate ----> photo of House
Restaurants ----> photo of Plate of Food
Health ------> photo of Doctors office
...and so on.
Any ideas??
Does anyone have a suggestion as to select a different header image per category.
To be clear...
Real Estate ----> photo of House
Restaurants ----> photo of Plate of Food
Health ------> photo of Doctors office
...and so on.
Any ideas??
The only way I think it can be done is to use a different header per category. You can specify different headers for each category in the Admin section. Each category has the possibility of having its own header, in the properties of each category.
Be careful though, I think you loose some functionality when using something other than the default template header.
FSGDAG | IndexU Hosting | Owner
Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
Follow Us On Twitter | FaceBook Profile | YouTube Videos
It would seem that one could do a block thing to display an image based on the category.
There would have to be a consistent image naming system.
The logic would go something like - <%if%> <%site_url%>/.../<%$cat_image%>.jpg exists display <%/if%>. $cat_image would be either the category name or number.
That way you could place the image where you wanted. That is just off the top of my head and would need work to keep from being very error prone.
Hi Harkster,
Create a cat_header.html by using the custom template function and copying/pasting header.html contents into it : cat_header.html will be the header of your categories instead of header.html.
Copy/paste this at the beginning of your cat_header.html :
<%php%>
/* category images will be stored in images directory */
/* filename of an image is catimage + category number */
/* there must be a cat00.jpg for absent images */
/* getting hold of category number */
$image_name = $this->get_template_vars('cat');
/* creating image name */
$image_name = "images/".image_name.".jpg";
/* if image_name does not exist let us get cat00.jpg */
if (!file_exists($image_name)) {
$image_name = images/cat00.jpg;
}
$this->_tpl_vars['image_name'] = $image_name;
<%/php%>
Now $image_name should contain the path to your image to use in your cat_header.html file
You just have now to replace header.html by cat_header.html in your browse.html.
I did not test it, but I derived it from a code of mine that works fine.
So let's hope this will do ...
Have a nice day
Gus
<%php%>
/* category images will be stored in images directory */
/* filename of an image is catimage + category number */
/* there must be a catimage00.jpg for absent images */
/* getting hold of category number */
$image_name = $this->get_template_vars('cat');
/* creating image name */
$image_name = "images/catimage".image_name.".jpg";
/* if image_name does not exist let us get cat00.jpg */
if (!file_exists($image_name)) {
$image_name = "images/catimage00.jpg";
}
$this->_tpl_vars['image_name'] = $image_name;
<%/php%>
Should be better now !
Gus