Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

How to compare dates.

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
marcelodelta
Smarty Rookie


Joined: 04 Apr 2009
Posts: 8

PostPosted: Fri Jul 10, 2009 11:56 pm    Post subject: How to compare dates. Reply with quote

hello people.

How to compare dates.

$year= date("Y");
while ($year>= 2005)
{
$year-= 1;

$smarty->assign("anno",$year);
}

template.

{section name=i loop=$anno}
{$anno[i]}
{/section}

Result actual:
2004
2004
2004
2004
2004
2004
2004...


Result expected
2008
2007
2006
2005
2004


---------------
what would be the problem?

could someone help?

ths
Marcelo Wanderley
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sat Jul 11, 2009 12:00 am    Post subject: Reply with quote

Code:
$year= date("Y");
while ($year>= 2005)
{
$year-= 1;
$anno[] = $year;
}
$smarty->assign("anno",$anno);
 
Back to top
View user's profile Send private message Visit poster's website
marcelodelta
Smarty Rookie


Joined: 04 Apr 2009
Posts: 8

PostPosted: Sat Jul 11, 2009 1:32 pm    Post subject: Reply with quote

Hi mohrt,

thank you very much...

Work correctly now.

ths
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP