Suggestions & Feedback
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsForum InformationSuggestions & Feedback

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old December 18th, 2002, 07:31 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
lwtCalendar suggestion

Just wanted to pass this on to to others. If you want your calendar to open up on the next event here is a quick function to do so.

php Code:
Original - php Code
  1. // Quick util function 
  2. function get_next_event() {
  3.        
  4.         global $ltw_config;
  5.         $db = new ltw_db;
  6.         $calendar_table = $ltw_config['db_table_calendar'];  
  7.        
  8.         $query = "SELECT UNIX_TIMESTAMP(event_date) as stamp FROM $calendar_table WHERE event_date > (DATE_SUB(now(), INTERVAL "1" DAY)) order by event_date LIMIT 1";
  9.         $result = $db->db_query($query);
  10.         $row = $db->db_fetch_array($result);
  11.                
  12.         return($row['stamp']);
  13.                
  14. } //end get_next_event()
  15.  


Then near the very bottom of calendar.php under the default switch change $timestamp=time(); to $timestamp=get_next_event();

This could quickly be added as a config in lwtconfig. Just use an if-else statement.

To the author.... Just wanted to say thanks for putting the code out there. Very nice and clean. I need to make some modifications for my needs, but I really do appreciate the great lead you gave me.

Mike
mikejp.@.NOSPAM.videotron.ca.NOSPAM.

Reply With Quote
  #2  
Old December 18th, 2002, 07:43 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: lwtCalendar suggestion

Just realized... that if you have no events coming up you would probably be sent to 1970,

So revised function is

php Code:
Original - php Code
  1.  
  2.  
  3. // Quick util function 
  4. function get_next_event() {
  5.        
  6.         global $ltw_config;
  7.        
  8.         $db = new ltw_db;
  9.         $calendar_table = $ltw_config['db_table_calendar'];  
  10.        
  11.         $query = "SELECT UNIX_TIMESTAMP(event_date) as stamp FROM $calendar_table WHERE event_date > (DATE_SUB(now(), INTERVAL "1" DAY)) order by event_date LIMIT 1";
  12.         $result = $db->db_query($query);
  13.         $row = $db->db_fetch_array($result);
  14.  
  15.         if($db->db_numrows($result) == 0) {
  16.             $stamp = time();
  17.         } else {
  18.             $stamp = $row['stamp'];
  19.         }
  20.    
  21.         return($stamp);
  22.                
  23. } //end get_next_event()
  24.  


Reply With Quote
Reply

Viewing: Codewalkers ForumsForum InformationSuggestions & Feedback > lwtCalendar suggestion


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway