2008-07-17, 08:17 PM
Hi,
time ago i made a plugin (just for fun) which extends MyBB's template engine.
A basic example of how it works is:
And if i insert in the template the following code:
If i insert this
A more complex example is
In template i put this:
If you are a guest it outputs "Bye bye" else it outputs you can't view this.
Basically it is a little framework (by default it has only 3/4 functions, the concept is i give the core, you extend it by adding new methods) which extends the template engine, you could extend a template engine by writing some PHP functions.
My question is: would you be interested in seeing this for 1.4?
If i receive a good demand for this, i could port it to 1.4 and releasing it with some new features (one of these is to include currenttemplate_functions.php which would contains some functions designed for the template in use )
Regards
time ago i made a plugin (just for fun) which extends MyBB's template engine.
A basic example of how it works is:
function tatote_method_datenow($args, $text)
{
global $mybb;
if(empty($args))
$args = $mybb->settings['dateformat'];
return date($args);
}
And if i insert in the template the following code:
{datenow}
It outputs 07-17-2008If i insert this
{datenow Y-m-d}
It outputs 2008-07-17A more complex example is
function tatote_method_restrict_to($args, $text)
{
global $mybb;
if($mybb->usergroup['gid'] == intval($args))
return $text;
else
return "You can't view this";
}
In template i put this:
{restrict_to 1}Bye bye{/restrict_to}
If you are a guest it outputs "Bye bye" else it outputs you can't view this.
Basically it is a little framework (by default it has only 3/4 functions, the concept is i give the core, you extend it by adding new methods) which extends the template engine, you could extend a template engine by writing some PHP functions.
My question is: would you be interested in seeing this for 1.4?
If i receive a good demand for this, i could port it to 1.4 and releasing it with some new features (one of these is to include currenttemplate_functions.php which would contains some functions designed for the template in use )
Regards