Jump to content

Show image in home on a specific day


Recommended Posts

I have to show an image in home page for a special offer that least only one day.

 

 

I created this code, but i don't undarstand how can i place into my home, i try to put it in my header.tpl file but i think the php doesn't work.

				<?php
					$giorno=date(j);
					$mese=date(n);
					if ($giorno==8) && ($mese==4) {
				?>
					<img style="margin:0 0 20px 20px" src="img.jpg" />
				<?php
					}
				?>

Any help?

Link to comment
Share on other sites

You can't use php directly inside smarty templates (not like that, at least). But in any case, the recommended way is creating a module, hook it to the top of pages, or where you want to display your image, then return a tpl file containing the image, only if those conditions are matched so like:

$giorno=date(j);
					$mese=date(n);
					if ($giorno==8) && ($mese==4){

						return $this->display(__FILE__, 'templatename.tpl');;
					}

					

Templatename.tpl would contain the image ;) Or you can return the image itself, anyway :)

Link to comment
Share on other sites

×
×
  • Create New...