Newbie question
| From: | Joel Lord | Date: | Fri, 10 Jan 2003 20:36:31 +0000 |
| Subject: | Newbie question | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-7119@lists.php.net to get a copy of this message | ||
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