One Question
| From: | Alex ILINSKI | Date: | Sat, 01 Jun 2002 03:29:53 +0000 |
| Subject: | One Question | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4490@lists.php.net to get a copy of this message | ||
Hello, guys.
Let me introduce myself. My name is Alex Ilinski, I'm the creator and the
maintainer of the russian nomicrosoft.ru site. I'm new at Smarty, but already
love it. Glad to be part of this list, I would like to saluate all the
subscribers. And pardon me my English: my first language is coding, the
second is russian, the third is french, and English after all. So I know that
I do horrible mistakes, but I'll try to avoid it.
So, here is my problem. First of all, I register a block in my PHP file:
<?
$smarty->register_block ("edt", "do_design_table");
function do_design_table ($params, $content, &$smarty)
{
if ($content != "")
print ("<table
border=5><tr><td>$content</td></tr></table>");
}
?>
Then, I put this in my smarty template:
{edt}Hello, world{/edt}
It works pretty well - I have a nice table with "Hello World" inside.
Next, I try something more complicated:
{edt}
{foreach from=$arr item=currval}
$currval
{/foreach}
It was the contents of "arr" array.
{/edt}
And with this construction, I have serious troubles. In the output, I have the
"arr" values displayed ABOVE the table, and only the "It was th contents..."
string goes inside.
Does somebody know what's the problem? I will be glad of any answer. Thank you
in advance and good luck!
--
Best regards,
Alex Ilinski (alex@nomicrosoft.ru)
http://www.nomicrosoft.ru head manager
http://forum.nomicrosoft.ru administrator