Log in

View Full Version : Conditional for Day of Week or Time of Day?


digitalhome
09-19-2006, 05:13 PM
I would like to create a conditional that would run one condition for Monday to Friday and something else for weekends.

Is this possible?

In addition, I would really like to layer on time of day. Ideally I would like to run one set of code between 8am to 11pm and then another bit of code for between 11pm and 8am.

I checked the vB 3.6 plug-ins for something that might do the trick but couldn't find anything.

Any way this is doable?

Thanks in advance!

bongwater
07-16-2007, 04:47 PM
I would also like to know if this conditional exists. Basically, I wanted to use conditionals to rotate between adsense ads and google referral ads every other day of the week.

Does anybody know if this is possible with the use of conditionals, and if so, what sort of coding should it look like?

digitalhome
07-16-2007, 05:34 PM
Essentially what I did back then was I used php to evaluate the day and time and then passed the result to vbulletin in the global_start hook location.

In my vbulletin template I put in a conditional that said what ad code to run depending on what the results were.

Sorry I can't be more specific but I took the code out about six months ago when I switched to openads for serving up my advertising

Kirk Y
07-16-2007, 06:13 PM
This is what I used to use for header rotations.

Create a plugin at hook location "global_start" with the following:
$today = vbdate('l', TIMENOW, false, false);Now you can use "$today" in your templates; it will return the current day (Monday, Tuesday, etc.).

<if condition="$today == 'Monday'">Today is Monday!!</if>