PDA

View Full Version : How do I render this in vB 4? lol


HMBeaty
03-17-2011, 12:52 PM
Been at this the past hour or so, and can't seem to get it right. I've had a look at this (https://vborg.vbsupport.ru/showthread.php?t=228078), which helped a little, but not entirely.

This is my old code from vB 3
if ($imp_vars['do'] == 'main')
{
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('MYCUSTOMTEMPLATE') . '");');
}

This is what I have so far with vB 4
if ($imp_vars['do'] == 'main')
{
$navbar = render_navbar_template($navbits);
$templater = vB_Template::create('MYCUSTOMTEMPLATE');
$templater->register_page_templates();
print_output($templater->render());
}
which apparently isn't correct since my navbar, navbits, and some of the rest of my template got messed up or not showing. So, using the 1st code, how would I do this in vB 4? Any help is appreciated :)

--------------- Added 1300370468 at 1300370468 ---------------

Erm, nevermind, I got it haha. Apparently I still had to register the variables in this section too...
if ($imp_vars['do'] == 'main')
{
$navbar = render_navbar_template($navbits);
$templater = vB_Template::create('MYCUSTOMTEMPLATE');
$templater->register('navbits', $navbits);
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register_page_templates();
print_output($templater->render());
}