Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Flat file calendar inclusion ????

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

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

Page: 1
Go to End
Author Topic: 1703 Views
  • DHN
    Avatar
    Community Member
    23 Posts

    Flat file calendar inclusion ???? Link to this post

    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

  • Re: Flat file calendar inclusion ???? Link to this post

    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!

  • DHN
    Avatar
    Community Member
    23 Posts

    Re: Flat file calendar inclusion ???? Link to this post

    thanks I'll try it out imediatly ;)

    1703 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.