The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Timestamp in vBulletin header
I need to pass a timestamp as a variable to a URL in an iFrame. In PHP it would be this:
PHP Code:
Thanks |
#2
|
||||
|
||||
I believe TIMENOW is available for use, so try just adding this to the template:
HTML Code:
<iframe src="http://www.SiteIamFraming.com/gim/?a={vb:raw timenow}" frameBorder="0" width="350" height="180" scrolling="no" id="iframeID" style=\"display:block;\"> </iframe> |
#3
|
|||
|
|||
That's returning nothing -- is there a way to make it print to the screen in the template code as "echo" does in PHP?
BTW I should have mentioned I am working in vBulletin 4. |
#4
|
||||
|
||||
You may need to write a plugin then to create a variable that has the time. Probably use one of the global* hook locations.
No, you cannot use any php in a template. |
#5
|
|||
|
|||
Bummer. I don't see why this has to be so hard.
Thanks for your help. |
#6
|
||||
|
||||
It shouldn't be that hard. Did you try just adding a plugin to create the variable (you will need to preregister the variable for use in what template you are using it in also).
|
#7
|
|||
|
|||
Lynne,
I've been looking at other plugins as examples and created a simple plugin and activated it. I think I have most of it, but I am confused about where the preregistering line goes, and not really sure about which hook location to use. So two questions: 1. Should the hook location be global_start or something else? 2. My variable is called includeticker. I am confused about where to put the preregister line (which I think is right (below). Should I be using "header"? Our forum has various templates. Should the actual name of the template be where "header" is in my line? Like "Blue Template" if that's the name? PHP Code:
Once those are figured out all I have to do is insert this where I want it to appear in the header, right? PHP Code:
Dan |
#8
|
||||
|
||||
1. You can try global_start. That hook is supposed to be deprecated, but it doesn't seem to be going away at all. You can also try global_bootstrap_complete which is the one I have used before to preregister a variable for the header template.
2. If you want to use the variable in another template, then just replace "header" with the name of the other template. If you need to register it for use for several templates, then just have several preregister lines. You can just put that line at the bottom of your plugin. |
#9
|
|||
|
|||
Success!!!
I switched the hook location to template_render_output and that did it. Lynne, thanks for all your help. I never would have gotten this to work without your guidance. Dan |
Благодарность от: | ||
Lynne |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|