JamesBen08 Posted December 13, 2018 Posted December 13, 2018 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 Share this post Link to post Share on other sites More sharing options...
Haumea Posted December 14, 2018 Posted December 14, 2018 Do it in the product Controller file and assign a flag to the tpl. In the flag is 1 you print a message on the tpl file. Share this post Link to post Share on other sites More sharing options...
Hehn-MB Posted December 21, 2022 Posted December 21, 2022 (edited) 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 December 21, 2022 by Hehn-MB (see edit history) Share this post Link to post Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now