Jump to content

Show message at a specific date


JamesBen08

Recommended Posts

Hello everyone ,

 

I would like to add on .tpl a message to appear on a specific date .

 

For example if i want to write an "Happy New Year Message" between the 01/01/19 and 03/01/19 on product.tpl

 

I tried using

{if ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= 2019-01-03 00:00:00)  && ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= 2018-12-31 23:59:00) }   

But it is not working ( i tried with a proper date of course 🤣)

 

 

Any idea ?

Thanks in advance

Link to comment
Share on other sites

  • 4 years later...

It's surely too late for JamesBen08 but if you have v 1.7.8.x and take into account that 'date_format' produces a string then

{if ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' > '2022-12-15 00:00:00') && ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' < '2023-01-02 00:00:00')}
...
{/if}

will do in my template for christmas season.

Edited by Hehn-MB (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...