, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > Code Snippets > Upcoming Calendar Events in a Page

FlexCMS Support Forum


Upcoming Calendar Events in a Page
Started June 21, 2005 @ 7:53pm by jacmgr
Post Message 
jacmgr


Posts: 18
 
Upcoming Calendar Events in a PageJune 21, 2005 @ 7:53pm
This is a modified version of the code that the FLEX team posted for the TODAYS EVENTS in a BLOCK.

If you have a page that is set to process php, you can add this code to display a list of upcoming events in your page. I found it easier to save this snippet as its own file and then use a php include statement in the page where I want it to appear. But you can simpley copy and paste this directly into your page. All you have to do is set the variables near the top for the number of days you want to show and the title you want to appear in the table header.

See it in action at http://www.vacationrentalworkshop.com/poconos near the bottom of the page.

// ----------------------------------------------
// ----------------------------------------------
// Prints a table of upcoming calendar data
// Includes Events, Holidays (how to choose?)
// Defualts to 90 days
// ----------------------------------------------
// requires these variable set:
// $future = 120; //number of days to get
// $eventtype = '1,2'; // not implemented yet!!
// $mytitle = '<h1>Upcoming Events</h1>';
// The table can have a CSS class if you want to format it nicely.
// Just give the table a class and put formats on the TH and TD
// You will have to put that CSS in your template file in the HEAD section.
// ----------------------------------------------
$future = 120; //number of days to get
$eventtype = '1,2'; // not implemented yet!!
$mytitle = '<h1>Upcoming Events</h1>';
// ----------------------------------------------
print $mytitle;
$TZO = (($Settings['TimezoneOffset']+5)*3600);
//todays date
$DateSplit = getdate();
$DayTimestamp = mktime(0,0,0,$DateSplit['mon'],$DateSplit['mday'],$DateSplit['year']);
//THIS IS GENERALIZED FOR NEXT $future days
$DayTimestampEND = mktime(0,0,0,$DateSplit['mon'],$DateSplit['mday']+$future,$DateSplit['year']);

$query55 = "select * from `".$Settings['DBPrefix']."cl-EventDates` where DateCode>=".($DayTimestamp+$TZO)." and DateCode<".($DayTimestampEND)." order by DateCode asc";
$result55 = mysql_query($query55) or die (mysql_error());
// ----------------------------------------------
// END of Main Query to get events header for events in the date range
// ----------------------------------------------
//
//print the table header
//
print '<table class="j_style1">
<tr><th>Date and Description<br>click on date for more info</th>
</tr>';
// -----------------------------------
// For each event query the details and print the table rows
// ------------------------------------
if (mysql_num_rows($result55) > 0)
{
while ($row55 = mysql_fetch_array($result55))
{

$query5 = "select * from `".$Settings['DBPrefix']."cl-Events` where RecordNumber='".$row55['EventID']."' and MinLevel<='".$UserLevel."' limit 1";
$result5 = mysql_query($query5) or die (mysql_error());
if (mysql_num_rows($result5) > 0)
{
$row5 = mysql_fetch_array($result5);
$a = date("D M j", $row55['DateCode']);
$LinkString='<a href="'.$MainURL.'/calendar/details/'.$row5['RecordNumber'].'.html">'.$a.'</a>';
// print the table row
print '<tr><td align="center"> '.$LinkString.' : '.$row5['Title'].'</td></tr>';

$EventsPrinted++;
}
}
}
if ($EventsPrinted < 1)
{
print '<tr><td>?</td><td>No Events listed for next $future days</td></tr>';
}
// ----------------------------------------------
// end the table
// ----------------------------------------------
print '</table>';
// ----------------------------------------------
// END CALENDER SNIPPET
// ----------------------------------------------
 

Last Edit: June 21, 2005 @ 7:54pm by jacmgr
DCSun
Administrator



Posts: 625
 
November 21, 2007 @ 2:56pm
Admin Note:
Support request concerning the syntax for including scripts in a page has been moved here: http://www.flexcms.com/index.php/forum/thread/296.html.

Please open a new thread in the General Support Requests board for future support requests.


Thanks!


FlexCMS v3.2 Has Been Released!
 

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.07868 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS