|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
vit1251 Smarty n00b
Joined: 04 Oct 2010 Posts: 1
|
Posted: Mon Oct 04, 2010 2:09 pm Post subject: SmartyFor |
|
|
Some strange using section and other block:
Code: |
function smarty_block_for($params, $content, &$smarty, &$repeat) {
if ( !isset( $smarty->_tpl_vars[ $params['var'] ] ) ) {
$smarty->_tpl_vars[ $params['var'] ] = $params['start'];
}
if (is_null($content)) {
return;
}
//echo $smarty->_tpl_vars[ $params['var'] ];
$smarty->_tpl_vars[ $params['var'] ] += intval( $params['step'] );
if ( abs($params['step']) == $params['step'] ) {
$repeat = $smarty->_tpl_vars[ $params['var'] ] <= $params['end'] ;
} else {
$repeat = $smarty->_tpl_vars[ $params['var'] ] >= $params['end'] ;
}
if ( $repeat === false ) {
unset( $smarty->_tpl_vars[ $params['var'] ] );
}
return $content;
}
|
I am write my first text block plugin...[/code] |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Oct 04, 2010 2:32 pm Post subject: |
|
|
{for} is already used by Smarty 3. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|