Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 09-19-2004, 06:17 PM
DJ RRebel DJ RRebel is offline
 
Join Date: Jul 2002
Location: CANADA
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Date and Time Variables

OK .. having a bit of a problem here figuring out what Date and Time variables are availlable. Would appreciate any help!


Firstly, what I'm looking to do, is be able to use an if/else statement to do/show something dependant on if the 'forum time' falls into a certain range (BETWEEN $feature_open AND $feature_close). Is there a variable that is accessable for your forum's time? By forum time, I mean server time + $vboptions[hourdiff] (which is the variable I found for server to forum offset).

Or would I be better off adding the following in global.php if it's a variable I'll be using alot?

PHP Code:
$forumtime date() + $vboptions[hourdiff]; 

I'm very new to this and still learning the basics of PHP, but am I correct in assuming date() is the php function to get the unix time on your forum's server?

I'm guessing since I'll be using it for both comparisons and display, that it would be best to keep it in unix time (seconds since 1970), and then later just format it for display purposes? Is this the IF statement I should use?

PHP Code:
if($forumtime $feature_open && $forum_time $feature_close)
{ do; 
whateverIneedto; do; here; if; true; }
else
{ do; 
whateverIneedto; do; here; if; false; } 
I'm guessing once I learn how to access info from the database, I could also do the following SQL command? Obviously I'm not entirely sure how to do this yet, as the following could just be a pile of garbage ... lol:

Code:
$features = 
however_connect_to_table_then_add_SQL_
 SELECT needed_data1, needed_data2
 FROM feature_data_and_date_range_table
 WHERE (getdate() BETWEEN feature_open AND feature_close)
     AND feature_id = $feature_to_get_if_in_range;

Do vB variables have 'scope' (learning new terms .. lol) within SQL statements in vB PHP pages?

Also, when wanting to enter the date range to my database to store the range something will be availlable, should I use the following if I used the coresponding form variable on the submit page?

$feature_open = mktime(open_hour,0,0,open_month,open_day,open_year );

and

$feature_close = mktime(close_hour,0,0,close_month,close_day,close_ year);



I'm still not sure how to plug it all into the appropriate database fields, but I'm sure some searching in these and/or other MySQL forums will help, or simply looking at similar code already in vB. Otherwise I 'll start a new topic not to mix it up with this one.



THANKS TO ANY AND ALL WHO EVEN TRY TO READ THE ABOVE MESS !!! LOL
Reply With Quote
  #2  
Old 09-20-2004, 03:31 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Questions about modifying vBulletin's default behaviour and asking about modifications in general, should be posted in General vBulletin Questions. Please read the forum descriptions more carefully in future. I've moved your thread there for you

Thanks,
- Dean
Reply With Quote
  #3  
Old 09-22-2004, 04:51 AM
DJ RRebel DJ RRebel is offline
 
Join Date: Jul 2002
Location: CANADA
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK cool ... thanks ... ... Thought it was more of a modification at the time, but now I guess it's more of a "How Do I?" ... lol

Anyhow ... anyone have any feedback or comments for me ???
Reply With Quote
Reply

Thread Tools
Display Modes

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 05:44 PM.


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.07372 seconds
  • Memory Usage 2,182KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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_postinfo_query
  • fetch_postinfo
  • 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