![]() |
Help with setting variables
We just switched our forum over to vbulletin and love it but I'm having trouble understanding the way mods are put together. I'm not finding much for documentation on the new variable system in vb4 (We have suite)
I'm trying to update a very simple mod that was available for 3.6 that isn't available for 4 and I'm not getting the variables for some reason. When I install this (updated by me): HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?> And place this in my forumhome template: PHP Code:
I get this: Code:
There have been %1$s post in the last %2$s hours If I use vb:raw rather than vb:rawphrase the line is not inserted at all...I also checked my php logs and there are no errors. Sorry if it's obvious but I'm a noob at vbulletin :-) Any help would be appreciated, even a nudge towards some documentation I missed. Charles |
I think you need to add this line (before or after the other register() call):
Code:
$templater->register('timeframe', $timeframe); and then in the template: Code:
<vb:if condition="$vboptions['posts_last_x_hours_enabled'] == 1"> BTW, there's some info in the manual that might be helpful: https://www.vbulletin.com/docs/html/ (search for "template syntax") |
Thanks for the help kh99, now I understand how to call the phrase with variables.
I have bigger problems though. For some reason it doesn't seem to be cycling through the code at all so I'll have to play with it more. I changed the php cdata to this: Code:
if ($vbulletin->options['posts_last_x_hours_enabled']) Code:
There have been post(s) in the last hours. the "*" doesn't show up in my phrase for {1} or {2}, they come up blank within the phrase. I'll have to keep playing with it. |
Oh...I didn't notice that $templater isn't defined. You need to use preRegister instead, like this:
Code:
vB_Template::preRegister('FORUMHOME', array('posts_last_x_hours' => $posts_last_x_hours, |
That worked great :) Thank you so much!
|
All times are GMT. The time now is 04:45 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|