i've modified the header.html file in the template directory to include an advert... this advert is on all pages of the site.
what is the easiest way to only show this advert on the main (index) page and not the entire site?
i've modified the header.html file in the template directory to include an advert... this advert is on all pages of the site.
what is the easiest way to only show this advert on the main (index) page and not the entire site?
If you only want it to display on the index then the easiest thing to do is only add it to index.html
Your alternative is to add it to the header and then try and make some code so that ad will only display when a user visits the index page. No idea what code you'd use, but it should be possible.
Solution using code:
Just used php to find out the current url, and then if it matches the default entrance page of the site to display the advert.
<%php%>
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if ($url == 'http://www.website.com/') { echo '<img src="http://www.website.com/themes/default/images/advert.jpg>'; }
<%/php%>
Very nice