[SOLVED]Use {current_date} to show picture

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

[SOLVED]Use {current_date} to show picture

Post by Recon »

Hi,

I am trying to use {current_date} to change picture on website. I want to show different picture on every week. I have tried to use this:

Code: Select all

{$week = current_date format="%W"}
{if $week eq 43}
Some picture <img tag>
{elseif $week eq 44}
Some picture <img tag>
{elseif $week eq 45}
Some picture <img tag>
{/if} 
but obviously I can't write smarty, so this doesnt work ;D Why it's not working?

-R
Last edited by Recon on Wed Oct 26, 2011 7:47 am, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Use {current_date} to show picture

Post by RonnyK »

What if you just call the image like

image($week}.jpg

That way, there is a single call, and you can just create images called image01.jpg, image02.jpg etc....

Ronnyy
uniqu3

Re: Use {current_date} to show picture

Post by uniqu3 »

Use this and it will work:

Code: Select all

{assign var='week' value=$smarty.now|date_format:"%W"}
But as RonnyK said, using it as image name would probably make it easier to handle then having a bunch of if's for a small image.
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

Re: Use {current_date} to show picture

Post by Recon »

Works perfectly!!! Thank you guys! :-*

-R
Post Reply

Return to “CMSMS Core”