Re: Block functions
| From: | Andrei Zmievski | Date: | Tue, 26 Mar 2002 14:31:27 +0000 |
| Subject: | Re: Block functions | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3346@lists.php.net to get a copy of this message | ||
On Tue, 26 Mar 2002, Ivo Jansch wrote:
> What will it be when there's nothing between the tags? (for example,
> {table cols=3}{/table}
> Is it still possible to distinguish between start and end?
The $contents will be "" (empty string).
> What about attributes passed to the opening tag, will they be passed to
> the closing tag as well? {table cols=3}stuff{/table} seems a logical
> thing to do, but would the cols param then be available in the closing
> tag, or do we have to use global vars to remember them?
It is feasible to remember the opening tag attributes and pass them to
the closing tag. However, would someone ever want to specify different
attributes for the closing tag?
> Isn't it possible to call the handler only once, with all parameters?
> Most of the time, you have 1 piece of output from a set of
> opening/closing tags.
Having 2 calls is more flexible. In the opening tag call you may want to
initialize some data.
> Also, I think it's going to be inconvenient that you don't have the
> contents in the start tag.
That's not going to be possible to implement.
> Take for example {link
> url=http://www.phpinsider.com}Test{/link}.
> Only in the closing tag I know that there's something in between the
> tags, but in the opening tag, I would like to check that, so my opening
> will not generate the <a href=""> stuff.
In this case you can simply output everything when your closing tag is
called. At that time you know what the contents are.
-Andrei
* I don't mind going nowhere as long as it's an interesting path. *