Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Flat file calendar inclusion ????


Reply


3 Posts   1797 Views

Avatar
DHN

Community Member, 23 Posts

24 March 2008 at 9:50pm

Edited: 24/03/2008 9:51pm

Hi People

I really need some help on this one.. I have a flat file event calendar that i wish to include in the frontpage of a website.. but i haven't had any luck so far. i have attached the calendar if anyone would help, i would be really greatful since i really need this calendar implemented.... :)

Normally i would just use php include:

<?php
//-- calendar use example --//
include('./cal/calendar.php');
$calendar = new WingedCalendar();
$calendar->show_calendar();
?>

DHN

Avatar
Grayzag (aka ajshort)

29 Posts

25 March 2008 at 8:42am

Edited: 25/03/2008 8:43am

Hi there -

to include the calendar, firstly adapt the show_calendar function so it returns its content instead of dumping it. Next add a method something like this to your Page_Controller class:

function Calendar(){
//path to your calendar file, relative to silverstripe root
require_once(Director::baseFolder() . '/cal/calendar.php');
$calendar = new WingedCalendar();
//modify this to return content rather than printing
return $calendar->show_calendar();
}

And now you can display the calendar by putting $Calendar in your templates! Another note - make sure to put a _manifest_exclude file in the directory where your calendar files are stored as sapphire will include the contents of index.php - and we dont want that!

Avatar
DHN

Community Member, 23 Posts

25 March 2008 at 8:43am

thanks I'll try it out imediatly ;)