Block functions

From: Date: Mon, 25 Mar 2002 22:40:55 +0000
Subject: Block functions
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3338@lists.php.net to get a copy of this message
I have put in the initial implementation of block functions. For example, if you have the following template: {table cols=3} ... {/table} Then your block function is going to be called twice: once for the opening tag and once for the closing tag. The second time is when the actual content between the tags is passed to the function. The prototype for block function is like this: function smarty_block_table($params, $content, &$smarty) $content will be null for the opening tag so you can easily test whether you are being called for opening/closing tag by using isset($content). Block functions take precedence over custom functions with the same name. Also, you can pass attributes to the closing tag, e.g. {/table foo=yes}. I'd like to get feedback on this implementation, so download the snapshot Smarty-snapshot-20020325.tar.gz from the snapshots directory. -Andrei Hacker: Any person who derives joy from discovering ways to circumvent limitations.

« previous php.smarty.general (#3338) next »