Re: [SMARTY] One Question
| From: | Andrei Zmievski | Date: | Mon, 03 Jun 2002 21:12:15 +0000 |
| Subject: | Re: [SMARTY] One Question | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4557@lists.php.net to get a copy of this message | ||
Privet,
On Sat, 01 Jun 2002, Alex ILINSKI wrote:
> 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
Well, first of all, this should be {$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!
I don't see this happening. In my example I get correct output:
everything is inside the table.
What version of PHP are you using?
-Andrei http://www.gravitonic.com/
"Aim for success, not perfection. Never give up your right to be wrong,
because then you will lose the ability to learn new things and move
forward with your life. Remember that fear always lurks behind
perfectionism. Confronting your fears and allowing yourself the right to
be human can, paradoxically, make yourself a happier and more productive
person."
-- Dr. David M. Burns