Jump to:

22984 Posts in 11765 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » Embedding Google Calendar to site

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 2371 Views
  • Valorinbattle
    Avatar
    Community Member
    95 Posts

    Embedding Google Calendar to site Link to this post

    I'm trying to embed a Google Calendar to my site but the HTML Editor keeps stripping out the <iframe>. I saw some old posts in the archives about this, but don't have a clue what I'm doing with the TinyMCE. Also, Double-A-Ron has an archive about creating a new page type (CalendarPage) and inserting this code in the "class CalendarPage_Controller extends Page_Controller" section of CalendarPage.php:

    public function getGCalHTML()
    {
    $html = '<iframe src="http://www.google.com/calendar/embed?showCalendars=0&amp;height=600&amp;wkst=1&amp;bgcolor=%233366ff&amp;src=orphanhope%40gmail.com&amp;color=%232952A3&amp;ctz=Africa%2FJohannesburg" style=" border:solid 1px #777 " width="800" height="600" frameborder="0" scrolling="no"></iframe>'

    return $html;
    }

    But when I do this, I get a parse error for that last line that says "return $html;"

    Any help would be appreciated. Thanks!
    ~ James

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Embedding Google Calendar to site Link to this post

    I've had the some issue, with iframes and onClicks. Silverstripe is being to cleaver and brutally pulling these out. Kind of forces the admin to think of a more compliant way to implement these things.

    you're missing a closing semi-colon at the the end of the $html variable, It worked a treat after that.

    Hope that helps

  • Valorinbattle
    Avatar
    Community Member
    95 Posts

    Re: Embedding Google Calendar to site Link to this post

    Bambii7 thanks for the help!

    So should it read like this:

    return $html;;
    }

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Embedding Google Calendar to site Link to this post

    Um more like

    public function getGCalHTML()
    {
    $html = '<iframe src="http://www.google.com/calendar/embed?showCalendars=0&amp;height=600&amp;wkst=1&amp;bgcolor=%233366ff&amp;src=orphanhope%40gmail.com&amp;color=%232952A3&amp;ctz=Africa%2FJohannesburg" style=" border:solid 1px #777 " width="800" height="600" frameborder="0" scrolling="no"></iframe>';

    return $html;
    }

    php needs know when you're done defining a statement or variable. It's pretty mush a full stop after a sentace.

    $html = 'stuff to print';
    The semi-colon at the end of that variable tells php it's the end of that statement.

  • Valorinbattle
    Avatar
    Community Member
    95 Posts

    Re: Embedding Google Calendar to site Link to this post

    Bambii7 - thank you! That worked perfectly.

    ~ James

    2371 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.