Re: [SMARTY-DEV] repeatable blocks
| From: | messju mohr | Date: | Sun, 20 Apr 2003 13:58:33 +0000 |
| Subject: | Re: [SMARTY-DEV] repeatable blocks | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1230@lists.php.net to get a copy of this message | ||
On Sun, Apr 20, 2003 at 03:41:31PM +0200, Matthias Pigulla wrote:
> hi,
>
> haven't looked further into it yet - but does this obsolete your compilerblock plugins
> patch dated Dec 3, 2002?
yes i think so.
> I just added that funcitonality into my copy of the 2.5 version because I needed it. Why
> didn't that do into the official release?
because it wasn't not good enough ;-)
the first compilerblock-patch introduced a fully new type of plugin
and thus bloated smartys api unnecessarily.
this one extends the existings blocks-functionality (IMHO nicely)
without the need to dig into the compiled smarty-template-code.
i'm pretty sure you can port your compiler-block-plugins to the
block-repeat-stuff and they will look cleaner and be more maintainable
afterwards. but i haven't seen what you've done and what you needed
them for.
as a side note: if you really, really need blocks at compiler-level (i
wouldn't know what for anymore, though) and don't want to have to
patch Smarty after every release, you can use an undocumented feature:
just register two compiler-functions and name one with a leading slash:
$smarty->register_compiler_function('block', 'block_open_impl');
$smarty->register_compiler_function('/block', 'block_close_impl');
then you can use {block}...{/block} inside your templates. you'll have
to maintain your own stacks and check for correct nesting etc. though.
it was never confirmed, that this is legal, but it wasn't denied
also. so use it at your own risk or ask mom and dad if you're allowed
to play with it :-)