How would one go about doing this in a way that would make a custom template available in all other templates, and not have to preRegister each of them?
Here's what I have so far.
cache_templates
PHP Code:
$cache = array_merge($cache, array(
'layout_a',
'layout_b',
'layout_c',
'layout_d'
));
parse_templates
PHP Code:
global $layout_a, $layout_b, $layout_c, $layout_d;
$layout_a = vB_Template::create('layout_a')->render();
$layout_b = vB_Template::create('layout_b')->render();
$layout_c = vB_Template::create('layout_c')->render();
$layout_d = vB_Template::create('layout_d')->render();
}
But I think it should be more like:
parse_templates
PHP Code:
global $layout_a, $layout_b, $layout_c, $layout_d;
$layout_a = vB_Template::create('layout_a')->render();
$layout_b = vB_Template::create('layout_b')->render();
$layout_c = vB_Template::create('layout_c')->render();
$layout_d = vB_Template::create('layout_d')->render();
// for each cached template, global or otherwise, register
// the above templates as variables
foreach ($globaltemplates as $key => $value)
{
vB_Template::preRegister($key, array(
'layout_a' => $layout_a,
'layout_b' => $layout_b,
'layout_c' => $layout_c,
'layout_d' => $layout_d
));
I know it doesn't work, but that's because I'm not sure what array to use/globalize here.
Help?