The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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> Code:
Variable: $someVariable |
#2
|
|||
|
|||
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. |
#3
|
||||
|
||||
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?
|
#4
|
|||
|
|||
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.
|
#5
|
||||
|
||||
yeah its different for each post the actual template will contain
Code:
./$vboptions[drcpo_sup_pb_img_dir]/$post[userid].$post[pbext] and the variable would be used as the img src, its for getting user defined pb bkgs |
#6
|
|||
|
|||
Oh, OK, then just move it to postbit_display_complete and you're good.
|
#7
|
||||
|
||||
=) thank you thank you
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|