vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Conditional for Day of Week or Time of Day? (https://vborg.vbsupport.ru/showthread.php?t=127044)

digitalhome 09-19-2006 05:13 PM

Conditional for Day of Week or Time of Day?
 
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:
Code:

$today = vbdate('l', TIMENOW, false, false);
Now you can use "$today" in your templates; it will return the current day (Monday, Tuesday, etc.).

Code:

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


All times are GMT. The time now is 09:22 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03121 seconds
  • Memory Usage 1,707KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete