Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-21-2002, 04:30 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Rotate styles by day.

Say i have 7 styles made for my forums, they only differ in color. Now say i want style 1 to display on sunday, style 2 on monday etc. Would it be possible to write a script that would automaticly change the default style at 12 midnight everyday?.
Reply With Quote
  #2  
Old 11-21-2002, 08:25 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are some issues to be solved like if your style will overwrite forum's forced styles or user's custom style but assuming answers are no for both here is your code:

edit global.php (in forum dir, not in Admin dir!), find:
PHP Code:
// is style in the forum/thread set?
if (isset($codestyleid) and $codestyleid!=0) {
  
$styleid=$codestyleid;
} else {

  
// Will look in the user info for a style
  
if ($bbuserinfo['styleid']!=0) { //style specified
    
$styleid=$bbuserinfo['styleid'];
  } else { 
//no style
    
$styleid=1;
  } 
Replace it as:
PHP Code:
// is style in the forum/thread set?
if (isset($codestyleid) and $codestyleid!=0) {
  
$styleid=$codestyleid;
} else {

  
// Will look in the user info for a style
  
if ($bbuserinfo['styleid']!=0) { //style specified
    
$styleid=$bbuserinfo['styleid'];
  } else { 
//no style
$styleid=date("w",time())+1;
  } 
Now the hack will make these styles default automatically everyday at 12:00 AM (According to the server time!):
Sunday => Style 1
Monday => Style 2
..
..
Saturday => Style 7

Enjoy.. :glasses:
Reply With Quote
  #3  
Old 11-21-2002, 10:20 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks man, ill make sure to use this when we introduce the new styles next week
Reply With Quote
  #4  
Old 11-21-2002, 10:23 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Last question, seeing how the code is style 1 (sunday) would be named '0' correct?
Reply With Quote
  #5  
Old 11-21-2002, 11:10 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I didn't get the question
Reply With Quote
  #6  
Old 11-21-2002, 11:43 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well seeing out its using the date function i looked it up, heres the quote of what i read:

Quote:
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
but now i see a +1 in your code.

Heres the question, what would the name of the styles be? 1, or style 1? Im not clear on how it works. Again thanks for all your help
Reply With Quote
  #7  
Old 11-21-2002, 12:18 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

style name does not matter. You can name styles in anyway you like.

My code is interested in style ids, not names. So it will display styleid 1 in sunday and 2 in monday etc.

If your styles are not in order, instead of $styleid=date("w",time())+1;
you can use this code:

if (date("w",time())==0)
{
$styleid=X; //enter id for sunday
}
elseif (date("w",time())==1)
{
$styleid=Y;
//enter id for monday
}
..
..
elseif (date("w",time())==6)
{
$styleid=Q;
//enter id for saturday
}

see?
Reply With Quote
  #8  
Old 11-21-2002, 12:28 PM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea, i relized it was id based when i was on my way to breakfast, thanks again
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:57 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07923 seconds
  • Memory Usage 2,231KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete