2008-12-06, 12:56 AM
I always ask coding questions here- maybe there should be a forum for non-mybb help (hint hint).
I have a template system which uses a template class. It uses extract() to get assigned variables to an instance of that class, includes a file (the template, cached from db) and replaces vars expressed as <?php echo $whatever ?>
For instance:
$articles = new Template("template.tpl.php");
$articles->addVar("whatever","this is a string");
$articles->init();
but what's a cleaner way of doing this instead of <?php ?> within a template?
I'm just asking for the principle, and maybe 2 or 3 lines of code if that'll help you explain. Any way is fine, including a mycode approach [var]whatever[/var] or like mybb does {$whatever} (prefer the mycode approach, but not by much).
Anyway thanks
Also I have looked in the mybb source code (haha lol it's how Learn ) but couldn't find anything.
Thanks for the time and for reading this long winded post with loads of extra unnecessary information
I have a template system which uses a template class. It uses extract() to get assigned variables to an instance of that class, includes a file (the template, cached from db) and replaces vars expressed as <?php echo $whatever ?>
For instance:
$articles = new Template("template.tpl.php");
$articles->addVar("whatever","this is a string");
$articles->init();
but what's a cleaner way of doing this instead of <?php ?> within a template?
I'm just asking for the principle, and maybe 2 or 3 lines of code if that'll help you explain. Any way is fine, including a mycode approach [var]whatever[/var] or like mybb does {$whatever} (prefer the mycode approach, but not by much).
Anyway thanks
Also I have looked in the mybb source code (haha lol it's how Learn ) but couldn't find anything.
Thanks for the time and for reading this long winded post with loads of extra unnecessary information