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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2015, 02:14 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default parsing and fetching template

ive done this a million times before but for some reason this isnt working, ive uninstalled the product reinstalled it but i cant fetch my template and its urkin me -_-
this is the snippit:
Code:
<template name="my_unique_tmplt" templatetype="template" date="0" username="DrCustUmz" version="1.0"><![CDATA[
SOME SHIT
]]></template>
	</templates>
	<plugins>
    <plugin active="1" executionorder="5">
			<title>cache template</title>
			<hookname>cache_templates</hookname>
			<phpcode><![CDATA[
				$globaltemplates = array_merge($globaltemplates, array('my_unique_tmplt'));
			]]></phpcode>
		</plugin>
		<plugin active="1" executionorder="5">
			<title>parse template</title>
			<hookname>parse_templates</hookname>
			<phpcode><![CDATA[
			eval('$someVariable = "' . fetch_template('my_unique_tmplt') . '";');
		]]></phpcode>
		</plugin>
and in postbit i added:

Code:
Variable: $someVariable
but it wont show is there a certain way you have to cache the template for calling it in the postbit?
Reply With Quote
  #2  
Old 03-03-2015, 02:19 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try changing the hook for the second plugin to postbit_display_complete. I believe the problem is that you're creating a globla variable called $someVariable, but the postbit template is evaled in a function, so your global isn't available.

I suppose another fix would be to use $GLOBALS['someVariable'] in the template. That would keep it from executing your plugin for every postbit.

Or you could make an additional plugin using hook postbit_display_complete that just had a global statement in it.
Reply With Quote
  #3  
Old 03-03-2015, 02:25 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks Kev, you always come through, I used "postbit_display_complete" hook and it works, but you were saying use global to prevent it from running every postbit? the varible will eventually be wrapped in an if condition, and needs to execute if post userid is w/e so should i be ok using it for every postbit?
Reply With Quote
  #4  
Old 03-03-2015, 02:34 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If it's just a template then it's not that big of a deal. But if it's always the same for the viewing user (doesn't use anything from the post) then it would be best to just have it eval once. There are a number of ways you could accomplish that. You could use hook postbit_display_complete but use a "global" statement and only eval it if the variable isn't set, or something like that.
Reply With Quote
  #5  
Old 03-03-2015, 02:40 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah its different for each post the actual template will contain
Code:
./$vboptions[drcpo_sup_pb_img_dir]/$post[userid].$post[pbext]
grabbing that posters data
and the variable would be used as the img src, its for getting user defined pb bkgs
Reply With Quote
  #6  
Old 03-03-2015, 02:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, OK, then just move it to postbit_display_complete and you're good.
Reply With Quote
  #7  
Old 03-03-2015, 02:45 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

=) thank you thank you
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 04:31 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.04017 seconds
  • Memory Usage 2,217KB
  • Queries Executed 13 (?)
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
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete