|
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 |
chrstr Smarty n00b
Joined: 20 Nov 2004 Posts: 2
|
Posted: Sat Nov 20, 2004 2:18 pm Post subject: while schleife mit arrays verwenden |
|
|
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 |
|
chrstr Smarty n00b
Joined: 20 Nov 2004 Posts: 2
|
Posted: Thu Nov 25, 2004 3:34 pm Post subject: |
|
|
kann mir da wirklich niemand mit den 2 deminsionalen arrays weiterhelfen? |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Nov 25, 2004 4:45 pm Post subject: |
|
|
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 |
|
|
|
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
|