|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Cronet Smarty Rookie
Joined: 21 May 2003 Posts: 15
|
Posted: Sat Oct 25, 2003 11:58 am Post subject: section-Problem |
|
|
Hi There...
I have a problem with the section Tag...
My PHP code looks like this:
Code: |
$date_month = array("1" => "Januar",
"2" => "Februar",
"3" => "März",
"4" => "April",
"5" => "Mai",
"6" => "Juni",
"7" => "Juli",
"8" => "August",
"9" => "September",
"10" => "Oktober",
"11" => "November",
"12" => "Dezember");
$smarty->assign( 'date_month', $date_month );
|
And now, i tried to create a section in the tpl file like this:
Code: |
<select name="monat">
{section name=monat loop=$date_month start="0"}
<option value="{counter}">{$date_month[monat]}</option>
{/section}
</select>
|
In the output, the first option tag is empty, and the array is only shown until November.
If I alter the section start to 1, the first option isn't empty, but still goes til November.
Debug says, that the Array has the Dezember within...
What is my fault?
Hope you can help me...
Greets
Cronet |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sat Oct 25, 2003 12:32 pm Post subject: |
|
|
your section loops from 0 to 11, but your array goes from 1 to 12. either rearrange the array-keys or use foreach instead of section (whatever fits better into you application) |
|
Back to top |
|
xavior Smarty Rookie
Joined: 24 Oct 2003 Posts: 5
|
Posted: Sat Oct 25, 2003 12:49 pm Post subject: |
|
|
try puting in "0" = > "" |
|
Back to top |
|
Cronet Smarty Rookie
Joined: 21 May 2003 Posts: 15
|
Posted: Sun Nov 02, 2003 1:37 am Post subject: |
|
|
Thank you !!
Worked fine
Cya
Cronet |
|
Back to top |
|
|
|
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
|