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.


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

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

Flat file calendar inclusion ????


3 Posts   1727 Views


24 March 2008 at 9:50pm (Last edited: 24 March 2008 9:51pm), Community Member, 23 Posts

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:

//-- calendar use example --//
$calendar = new WingedCalendar();


Grayzag (aka ajshort)

25 March 2008 at 8:42am (Last edited: 25 March 2008 8:43am), 29 Posts

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!


25 March 2008 at 8:43am Community Member, 23 Posts

thanks I'll try it out imediatly ;)