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, Ed, biapar, Willr, Ingo

Flat file calendar inclusion ????

Go to End

3 Posts   2042 Views


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:

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


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!


Community Member, 23 Posts

25 March 2008 at 8:43am

thanks I'll try it out imediatly ;)