SV: [SMARTY] section question

From: Date: Tue, 04 Nov 2003 09:50:25 +0000
Subject: SV: [SMARTY] section question
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10496@lists.php.net to get a copy of this message
Try {$news[news].headline} make sure {section name=news_loop=$news} is {section name=news loop=$news} (with no underscore between 'news' and 'loop') you might also find another name for name=news to avoid possible confusion: eg. {section name=newsIndex loop=$news} so that it becomes: {section name=newsIndex loop=$news} {$news[newsIndex].headline} {/section} Paolo > -----Oprindelig meddelelse----- > Fra: Franco Fallica [mailto:franco@cd-tipp.ch] > Sendt: 4. november 2003 10:28 > Til: smarty-general@lists.php.net > Emne: [SMARTY] section question > > > Hi everyone, > I have started using smarty but i have some troubles with it. can someone > pls help me. My question is haw exactly can i use arrays with section. I > read the manual but i guess i'm to stupid for it. > > so this is the loop with makes my array. (certainly this is not in the > template) > > while ($data=mysql_fetch_array($result)){ > $news[$news_zahl]["news_id"]=$data[news_id]; > $news[$news_zahl]["headline"]=$data[headline]; > $news[$news_zahl]["text"]=$data[text]; > $news[$news_zahl]["datum"]=$data[datum]; > $news[$news_zahl]["autor"]=$data[user]; > $news[$news_zahl]["artist"]=$data[artist]; > $news_zahl++; > } > $smarty->assign('news',$news); > > > and here is my section. I tried id a lot of ways but no one works. > > {section name=news_loop=$news} > Headline: {$news[headline]}<br> > {/section} > > i also tried > > {section name=news_loop=$news} > Headline: {$news.headline}<br> > {/section} > > outside of a section this works {$news[0].headline} > > can pls someone tell me the real syntax. > > kind regards > franco > > -- > CD-TIPP.CH > Franco Fallica > alter Zürichweg 14 > 8952 Schlieren > tel. u. fax: 079 340 76 42 > franco@cd-tipp.ch > http://www.cd-tipp.ch > > Visit our Forum at http://forum.cd-tipp.ch > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.smarty.general (#10496) next »