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

while schleife mit arrays verwenden

 
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
chrstr
Smarty n00b


Joined: 20 Nov 2004
Posts: 2

PostPosted: Sat Nov 20, 2004 2:18 pm    Post subject: while schleife mit arrays verwenden Reply with quote

hi!
so wiedermal ein problem mit while...ich hab bis jetzt auch die lösungen aus anderen threads probiert,leider immer ohne erfolg also in meinem php script wird folgendes array festgelegt..
Code:
        while($blog_content=mysql_fetch_object($blog_result)){
                 $comments=count_comments($blog_content->id);  //liest anzahl der kommentare aus
                 $date=date("d.m",$blog_content->date);
                 $blog_output=array();
                 $blog_output[$x]['date']=$date;
                 $blog_output[$x]['topic']=$blog_content->topic;
                 $blog_output[$x]['content']=$blog_content->content;
                 $blog_output[$x]['comments']=$comments;
             $x++;
         }
       return ($blog_output);


dann im eigentlichen php script verarbeitet
Code:

   if(!$date=$_REQUEST[date]){  $date=date("U"); } 
           if(!$site=$_REQUEST[site]){ $site=1; }
         $output=show_blog($date,$site);
         $blog_sites=blog_sites($date);

         $smarty->assign("output","$output");
         $smarty->assign("blog_sites","$blog_sites");
   $smarty->display('blog1.tpl');

und schlussendlich in der template verwendet
Code:
{foreach from=$output item="output"}
{$output.author} {$output.date}
{$output.content}
{ /foreach }

blöderweise funktioniert das ganze nicht..
habt ihr da vielleicht eine lösung?
Back to top
View user's profile Send private message
chrstr
Smarty n00b


Joined: 20 Nov 2004
Posts: 2

PostPosted: Thu Nov 25, 2004 3:34 pm    Post subject: Reply with quote

kann mir da wirklich niemand mit den 2 deminsionalen arrays weiterhelfen?
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Thu Nov 25, 2004 4:45 pm    Post subject: Reply with quote

falsch:
$smarty->assign("output","$output");
$smarty->assign("blog_sites","$blog_sites");

richtig:
$smarty->assign("output",$output);
$smarty->assign("blog_sites",$blog_sites);
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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