Compressing templates from 3 to 1 using this {if} for images
Posted: Wed Apr 04, 2012 5:04 pm
In an effort to reduce the amount of templates that I create, I have created this {if} statement which seems to work in order to replace the top header image depending on which page it is on. Its working, but is there an easier/shorter/standard way to accomplish this same effect?
Here is my {if} calling/replacing the image according to the page its on:
Before this, I was creating 3 or 4 different templates and only replacing the img src file just to accomplish this same thing; to display a different header top image on different pages. Another words, I was creating different templates for each page
I know, I know, but I didn't know how else to accomplish that.
Thank you for any feedback
Here is my {if} calling/replacing the image according to the page its on:
Code: Select all
<div id="top-header-container">
<div id="header-image">
<img src="{if $page_alias == "house-cleaning-services-maryland"}uploads/images/static-banner/static_top_banner_01.jpg
{elseif $page_alias == "cleaning-services-laurel-maryland"}uploads/images/static-banner/static_top_banner_02.jpg
{elseif $page_alias == "house-cleaning-company-maryland"}uploads/images/static-banner/static_top_banner_03.jpg
{else}uploads/images/static-banner/static_top_banner_01.jpg
{/if}">
</div>
</div>

I know, I know, but I didn't know how else to accomplish that.
Thank you for any feedback