TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 351
  • Total: 352
  • tino

[Block] Calendar Event Extraction (php Article)

Started by tim antley, May 04, 2009, 09:14:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zapiy

Hi brilliant mod, any chance it could show a rolling 4 week period? Hence its always an upto date block.

Cheers

Ianedres

Have you looked at the aforementioned strtotime php function on php.net mentioned in the thread?

It is very versatile in selecting a range.

zapiy

I will take a look but its a mine field to me lol..

Ianedres

View the strtotime function and set the $end variable in this line:

$end = date("Y-m-d", strtotime("next Sunday")); // see php.net for strtotime function examples; very robust!


"next Sunday" can be altered to "+4 weeks" or "next month" to accomplish a sliding range to look forward into your calendar. It may not detect everything you try, but you should be able find something that will work for you there.

zapiy


Mick

Very cool.   I dig this ;)


The php.net thread was a mile long so i had to take a guess on how to make this event code to look a whole year ahead.

I replaced  "next Sunday"   for "+1 year" and it seems to work.

http://www.chevyavalancheclub.com/index.php?page=292

Several questions for ya,....

-One thing i noticed,i see a "?" before the event name.  Any ideas why?
-Is there a way to only show 1 line of a 4-5 day event instead of showing the entire days?

Thanx,
Mick.  

Ianedres

Quote from: bluedevil on July 16, 2009, 11:12:34 PM
Very cool.   I dig this ;)

Thanks, and glad to hear it worked for you.
QuoteSeveral questions for ya,....

-One thing i noticed,i see a "?" before the event name.  Any ideas why?
-Is there a way to only show 1 line of a 4-5 day event instead of showing the entire days?

The question mark I think is the browser not displaying the non-breaking space properly in the lines with ' ' in the echo string. Change the portion in between the single quotes to a single space or a dash to keep the indent...

For one line to be displayed in multi-day events, it would probably require a significant change to the code...

pimpas

Quote from: Ianedres on May 04, 2009, 09:14:17 AM

// Calendar Event Extraction : Version 1.5 (php Article)
// set range; must be in YYYY-DD-MM format
$start = date("Y-m-d"); // defaults to current SERVER time (no offsets)


1st - You're the man! Excellent work :D

2nd - How can i set the offset time ? Is it possible?

Best regards

JPDeni

I know that Iandres is pretty busy these days, so he might not see this.

You could do something like this:


$now = $time() - 5 ; //alter this to the number of hours that you want to offset.
$start = date("Y-m-d",$now);

Ianedres

Thanks for filling in and getting a fix in motion there.

And, yes, work is very busy lately.  :-\


This website is proudly hosted on Crocweb Cloud Website Hosting.