Re: [SMARTY] Newbie question

From: Date: Fri, 10 Jan 2003 20:54:00 +0000
Subject: Re: [SMARTY] Newbie question
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7120@lists.php.net to get a copy of this message
{$htmlResult|default:#nodata#} if $htmlResults is empty, the value of #nodata# will be displayed instead. Monte On Fri, 2003-01-10 at 14:36, Joel Lord wrote: > Hi everyone, > I'm kinda new to SMARTY and to PHP so please excuse me if this is a > stupid question. I'm not quite sure how to explain this situation (my > English is really bad :P) so I'll give an example of my code > > Index.php > (code that retrieves a mysql recordset and loops through the records) > $html_result .= "<TR><TD>".$myrow[0]."</TD></TR>"; > (end of looping) > > if ($html_result = "") > { > $html_result = "{#nodata#}"; > } > > $smarty->assign("htmlResult", $html_result); > $smarty->assign("languagefile", "en.txt"); > $smarty->display("index.tpl"); > > index.tpl > {config_load file=$languagefile} > <HTML> > <BODY> > <TABLE> > {$htmlResult} > </TABLE> > </HTML> > > Now if there is some records, it prints out fine but if there is no > records, I was hoping it would print the variable #nodata# from the > language file, not "{#nodata#}. Is there a way to ask the template to > do that ? > > I'm not sure if that was clear but if anyone could help, I'd appreciate. > If you need more details, just ask, I'll do my best :P. > > Joel Lord -- Monte Ohrt <monte@ispi.net>

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