Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2011, 03:45 AM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Automatic Template Edits

I am trying to get:
{vb:raw affiliation}

To display my affiliation template within the forumhome template, but I am having no luck. It doesn't display anything when I place {vb:raw affiliation} in my FORUMHOME template.

hook - global_start
Code:
$templater = vB_Template::Create('affiliation');
vB_Template:reRegister('FORUMHOME',array('affiliation' => $affiliation));
$affiliation .= $templater->render();
Reply With Quote
  #2  
Old 02-08-2011, 04:41 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$templater vB_Template::create('affiliation');
vB_Template:preRegister('FORUMHOME', array('affiliation' => $templater->render())); 
Reply With Quote
  #3  
Old 02-08-2011, 05:12 AM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get a server error when using that code.
Reply With Quote
  #4  
Old 02-08-2011, 04:39 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to create and render a template and then preregister that variable for use in another template.

PHP Code:
$templater vB_Template::Create('affiliation');
// register any variables for use in your affiliation template here
$affiliation .= $templater->render();

vB_Template::preRegister('FORUMHOME',array('affiliation' => $affiliation)); 
Now use {vb:raw affiliation} in your FORUMHOME template.

Also, if you look up the hook global_start in the files, you'll see this:
PHP Code:
// Deprecated as of release 4.0.2, replaced by global_bootstrap_init_start
($hook vBulletinHook::fetch_hook('global_start')) ? eval($hook) : false
It's been deprecated for about a year now.
Reply With Quote
  #5  
Old 02-09-2011, 10:17 PM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used global_start with no problems, but as soon as I add your code, I get server errors. It works no problem before the code was added. Hooks work fine, but I would like to be able to place it anywhere in the forumhome. As soon as I add your code in place of mine, I get server errors.

Code:
			$templater = vB_Template::create('affiliation');
			$template_hook[forumhome_wgo_pos5] .= $templater->render();
Reply With Quote
  #6  
Old 02-09-2011, 11:17 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can't add exactly my code since I didn't input any variables to register in your template. Also, we can't help with errors if you don't tell us exactly what error you are getting. It would also help to actually see the affiliation template code.

Also, I accidentally wrote "reRegister" instead of "preRegister" in mine above which I have since fixed.
Also, <center> tags still work these days also, but they are deprecated. One of these days they will stop working, just as the global_start hook location will stop working. I've always figured it's best to fix that now, rather than when it gets broken, but that is your call.What is the code you posted for?
Reply With Quote
  #7  
Old 02-09-2011, 11:40 PM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What variables, this is what I don't understand. I don't have any variables. I simply just want the affiliation code to display in forumhome.

If global_start and center are going to be gone soon, what will be their replacing counterparts? Everyone uses <center> I don't know why it would be depreciated...
Reply With Quote
  #8  
Old 02-09-2011, 11:43 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Andreas View Post
PHP Code:
$templater vB_Template::create('affiliation');
vB_Template:preRegister('FORUMHOME', array('affiliation' => $templater->render())); 
I've never seen it done like this before. Does this actually work?
Reply With Quote
  #9  
Old 02-09-2011, 11:51 PM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
I've never seen it done like this before. Does this actually work?
No... apparently there are some variables that I don't know about, because it is still not working.
Reply With Quote
  #10  
Old 02-09-2011, 11:54 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What hook are you using to call the template from?
Reply With Quote
Reply

Thread Tools
Display Modes

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 10:46 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.12109 seconds
  • Memory Usage 2,257KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete