Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-17-2009, 05:18 AM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default $header and CMS

I have at global_start (also tried all different global)

PHP Code:
    $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?
Reply With Quote
  #2  
Old 11-17-2009, 10:38 PM
PitchouneN64ngc's Avatar
PitchouneN64ngc PitchouneN64ngc is offline
Senior Member
 
Join Date: Aug 2002
Location: France
Posts: 515
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can't call anymore $header like that.

Replace the last line by this:

PHP Code:
vB_Template::preRegister('header', array('livecart' => $livecart)); 
And add this at the end of the header template:

Code:
{vb:raw livecart}
Don't tested it, but it should work.
Reply With Quote
  #3  
Old 11-17-2009, 10:48 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks but that no longer displays anywhere with that method. Also I was trying to avoid a template edit
Reply With Quote
  #4  
Old 11-17-2009, 10:59 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

PHP Code:
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
Attached Images
File Type: jpg livecart.jpg (27.7 KB, 0 views)
Reply With Quote
  #5  
Old 11-18-2009, 12:28 AM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lionel you code is ok. The problem is simple, global_start is not called in CMS.
Use process_templates_complete hook with your code.
Reply With Quote
  #6  
Old 11-18-2009, 12:47 AM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:01 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.16487 seconds
  • Memory Usage 2,245KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (1)postbit_attachment
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete