The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
What is the time variable?
Here's an example of what I'm trying to do.
<vb:if condition="$time==1">stuff to do here</vb:if> So it will do something at a certain time. I just made "$time==1" up... I'm trying to figure out what goes there. Can anyone help? |
#2
|
|||
|
|||
The vB constant for the time is...
PHP Code:
|
#3
|
|||
|
|||
What do I put where the 1 is? I'm not sure what TIMENOW looks like.
For example, what if I want 6:00 AM? |
#4
|
|||
|
|||
Quote:
It's in seconds. So to get an hour ago, minus 3600. To go an hour in the future, add 3600. Maybe this will help Free Tool: Convert Unix Time Stamps To Readable Time and Date |
#5
|
|||
|
|||
So what exactly do I make condition equal to if I want
6:00 AM or 8:00 PM etc |
#6
|
|||
|
|||
Well, first you have to work out the users timezone if they are a member. So look at $vbulletin->options['hourdiff']
something like $timestamp = TIMENOW - $vbulletin->options['hourdiff']; Then you can get the hour with $hourofday = date("G", $timestamp ) Then you can work out the condition. if ($hourofday == 6) $message = "6AM"; if ($hourofday == 20) $message = "8PM"; |
#7
|
|||
|
|||
OK, well I'm doing this in my templates. I put that stuff in a plugin... but I don't really understand how plugins work.
Because then I went to my template and put <vb:if condition="$hourofday==6">stuff to do here</vb:if> and messed with the times I also did <vb:if condition="$hourofday">test</vb:if> to see if it even existed... but $hourofday didn't have any value apparently... ? this was my plugin: Code:
$timestamp = TIMENOW - $vbulletin->options['hourdiff']; $hourofday = date("G", $timestamp ); |
#8
|
|||
|
|||
Try:
$hourofday = intval(date("G", $timestamp )); I've seen that resolve a similar situation. Of course, it has to be 6 am to work too. |
#9
|
|||
|
|||
Actually, I'm seeing now that it works as a plugin alone. But what I don't understand is how I take that variable from the plugin and use it as the condition for my if-statement in the template.
|
#10
|
|||
|
|||
Post your code so we can see where you are.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|