vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Help Me, Please!! (https://vborg.vbsupport.ru/showthread.php?t=259025)

v123shine 02-17-2011 03:14 PM

Help Me, Please!!
 
Helo,
I have ads banner in my site, i want to disable ads banner from 1 PM untill 3 PM, is it possible to disable ads in custom time?

Thank You

kh99 02-17-2011 04:32 PM

You could do something like this: make a new plugin using hook global_start and this code:

Code:

// Uncomment only one of these...
$hourdiff = intval($vbulletin->options['hourdiff']); // User's local time
//$hourdiff = (date('Z', TIMENOW) / 3600) * 3600; // Default (using "Default Time Zone Offset")
//$hourdiff = 0; // Server Time

$thishour = date("G", max(0, time() - $hourdiff));
$show['timed_banner'] = ($thishour < 13 || $thishour >= 15);

(ETA: Made a change in the above to "$thishour >= 15", originally would have hidden banner between 1PM and 4 PM).

And then in the template put

Code:

<if condition="$show['timed_banner']">
...
</if>

around the part you want affected by the time.

The plugin part has three options: the way it is, it will use the user's local time (based on the time zone they have chosen in their profile), but you can choose the default time zone (from the Date Time settings), or just the server's time.

Naan-Kadavul 02-17-2011 09:48 PM

There is no such thing..on time limit..you have to do manually.


All times are GMT. The time now is 10:03 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.01027 seconds
  • Memory Usage 1,709KB
  • 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
  • (3)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