Helpful Information
 
 
Category: vB4 Programming Discussions
$header and CMS

I have at global_start (also tried all different global)

$templater = vB_Template::create('vbcart_livecart');
$templater->register('memberarea', $memberarea);
$livecart .= $templater->render();
$header .= $livecart;

That displays the cart contents in every single page of the site, except the CMS pages.

What am doing wrong?

You can't call anymore $header like that.

Replace the last line by this:

vB_Template::preRegister('header', array('livecart' => $livecart));

And add this at the end of the header template:

{vb:raw livecart}

Don't tested it, but it should work.

Thanks but that no longer displays anywhere with that method. Also I was trying to avoid a template edit

Here is the full code that works. When I switch the commenting for last line it no longer displays anywhere.

When I keep it as it is, it displays in all pages except the CMS pages

if ($ccount)
{

$templater = vB_Template::create('vbcart_livecart2');
$templater->register('ctotal', $ctotal);
$templater->register('ccount', $ccount);
$templater->register('myitem', $myitem);
$livecart = $templater->render();
} else
{
$memberarea = '';
if (is_member_of($vbulletin->userinfo, $vbulletin->options[covercart_usergroup]))
{
$templater = vB_Template::create('vbcart_livecartmemberarea');
$templater->register('memberarea', $memberarea);
$memberarea = $templater->render();
}
$templater = vB_Template::create('vbcart_livecart3');
$templater->register('memberarea', $memberarea);
$livecart = $templater->render();
}
$header .= $livecart;
//vB_Template::preRegister('header', array('livecart' => $livecart));

I am basically done converting this mod except for that and some peculiar tab situation

Lionel you code is ok. The problem is simple, global_start is not called in CMS.
Use process_templates_complete hook with your code.

Makes sense. But then, what is being called? I tried global_state_check which I know works everywhere, but that gives me other errors.

--------------- Added 17 Nov 2009 at 21:49 ---------------

hehehe did not fully read you.... (actually I only read your first reply from email, before adding the suggestion) that hook you suggested is perfect ... thanks!!!

Now I have to tackle that tab in profile










privacy (GDPR)