|
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 |
tino Smarty n00b
Joined: 05 May 2004 Posts: 1
|
Posted: Wed May 05, 2004 8:11 pm Post subject: block function |
|
|
hi,
i'm writing a CMS in which some users have permission to do all, some others can only read the content (lol, great idea, isnt'it? =)..
users have a level from 0 (guest) to 3 (admin), so i was thinking to define something like a block whose content is shown only if your level is > 2, for example:
bla bla bla...
{block level="}
this is seen only by people with level >=2
{/block}
bla bla bla...
i'm new to smarty, so i didn't understand if i have to do this with blocks or it is completely wrong, can anyone put me on the right way?
i've tryed defining function_block_level($parms, $content, &$smarty) but i see always what i have between {block} and {/block}... |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed May 05, 2004 8:33 pm Post subject: |
|
|
[php:1:e913ca6abb]
function_block_level($params, $content, &$smarty, &$repeat) {
global $user;
if (isset($content)) {
return $content;
} elseif ($params['level'] > $user->level) {
$repeat = false;
}
}
[/php:1:e913ca6abb]
and, of course, register it with $smarty->register_block('block', 'function_block_level'); |
|
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
|