View Full Version : $header and CMS
Lionel
11-17-2009, 05:18 AM
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?
PitchouneN64ngc
11-17-2009, 10:38 PM
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.
Lionel
11-17-2009, 10:48 PM
Thanks but that no longer displays anywhere with that method. Also I was trying to avoid a template edit
Lionel
11-17-2009, 10:59 PM
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
ForumsMods
11-18-2009, 12:28 AM
Lionel you code is ok. The problem is simple, global_start is not called in CMS.
Use process_templates_complete hook with your code.
Lionel
11-18-2009, 12:47 AM
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
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.