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

section-Problem

 
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
Cronet
Smarty Rookie


Joined: 21 May 2003
Posts: 15

PostPosted: Sat Oct 25, 2003 11:58 am    Post subject: section-Problem Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat Oct 25, 2003 12:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
xavior
Smarty Rookie


Joined: 24 Oct 2003
Posts: 5

PostPosted: Sat Oct 25, 2003 12:49 pm    Post subject: Reply with quote

try puting in "0" = > ""
Back to top
View user's profile Send private message
Cronet
Smarty Rookie


Joined: 21 May 2003
Posts: 15

PostPosted: Sun Nov 02, 2003 1:37 am    Post subject: Reply with quote

Thank you !!

Worked fine Smile

Cya
Cronet
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