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

Problem mit foreach Schleife

 
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 -> Language: German
View previous topic :: View next topic  
Author Message
deception
Smarty Rookie


Joined: 07 Sep 2004
Posts: 7

PostPosted: Tue Sep 07, 2004 6:41 am    Post subject: Problem mit foreach Schleife Reply with quote

Template:
Code:

{foreach from=data item=news}
<div id="iframe_news">
<p id="news_headline">{$news.headline}</p><br />
<p id="news_txt">{$news.news}</p><br />
<p id="news_date">Diese News wurde am {$news.date} verfasst.</p><br />
</div>
{/foreach}

PHP Code:
Code:

   $sql = "SELECT * FROM news ORDER BY id";
   $result = mysql_query($sql);
   $smarty_data = array();
   while ($data = mysql_fetch_array($result)) {
      $smarty_data[] = $data;
   }   
   $smarty->assign('data', $smarty_data);
   $smarty->display('main_news.tpl');


Kann mir einer Sagen was ich falsch mach? Der schreibt mir in news.headline und news.news und news.date imme nur ein "d" rein!

Mfg Max
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Tue Sep 07, 2004 7:27 am    Post subject: Reply with quote

es muss "{foreach from=$data item=news}" heissen.
du hast das $ vergessen.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
deception
Smarty Rookie


Joined: 07 Sep 2004
Posts: 7

PostPosted: Tue Sep 07, 2004 7:39 am    Post subject: Reply with quote

Ach du sch**** ist das Peinlich Embarassed Embarassed
*g*
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 -> Language: German 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