Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christophe 23 posts 43 karma points
    Feb 20, 2010 @ 16:50
    Christophe
    0

    Embed Google Calendar

    Hi,

    I'm a end user not a developer and I just discovered Umbraco so bare with me.  Someone set up my site on Umbraco (I love the simplicity of managing info) but I am trying to be add more functionality without add cost.

    The question is this: is there a way to embed my Google calendar into my page?  I tried to input the html code (<iframe...) into the editor but it does not display or keep it when I update.  I really don't get why Google Maps works fine but not the Calendar.  My work around now is a jpg thumbnail of a spreadsheet that has the calendar of events.

    Ultimately, is there an easy way to put a calendar for the events (or link the Events into a Calendar display)?  I am terrified of touching the "settings" and "developers" tabs in fear of screwing up the site (the guys that did it for me told me to stay out of it).  I am willing to try as long as it is fairly easy.

    Thank you in advance for a much appreciated help.

    Christophe

  • Seth Niemuth 275 posts 397 karma points
    Feb 20, 2010 @ 18:06
    Seth Niemuth
    0

    Probably the best thing to do would be to create a new macro for all your iframes. To do that, you can go to developer, right click the 'XSLT' folder and select 'create'. You can just select a blank template and tell it to create a macro with it. I saw in an old forum post the code for an iframe macro (that post is here: http://forum.umbraco.org/yaf_postst4641_cant-embed-html-in-page.aspx):

     Now make your xslt like this:

    Code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
        version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library"
        exclude-result-prefixes="msxml umbraco.library">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:variable name="location" select="/macro/location"/>
    <xsl:variable name="width" select="/macro/width"/>
    <xsl:variable name="height" select="/macro/height"/>

    <xsl:template match="/">
    <iframe src="{$location}" width="{$width}" height="{$height}" style="border: 0" frameborder="0" scrolling="no"></iframe>
    </xsl:template>

    </xsl:stylesheet>



    Save the XSLT. Then, expand 'Macros' and select the one you created and you will have to create 3 parameters "location", "width" and "height" as they are used in your XSLT file. Check the "Use in editor" checkbox and save it. 

    Now when you want to add an iframe somewhere in RTE just click on the "insert/edit macro" icon in the toolbar and insert the src from google calendar as well as the height and width.

  • Christophe 23 posts 43 karma points
    Feb 20, 2010 @ 19:55
    Christophe
    0

    Thanks Seth for your response!

    When I create my parameters, what "type" should I use?  I guess they are "numbers" but making sure.

    Thanks again

  • Christophe 23 posts 43 karma points
    Feb 20, 2010 @ 20:40
    Christophe
    0

    Sorry to bother you again, but I appear to be on the right track, I think.

    Okay I think I get it, location is the location of the calendar and the parameter type should be text (?) and width and height are numbers.

    If this is the case, I did that and here is what I do.  I go to my homepage for example and if I want to insert the calendar anywhere I just click "insert macro." Then in the "location" I put the "<iframe..." html code from the Google calendar and width and height.  When I do that I see an orange dotted rectangular box that says "No macro content available for WYSIWYG editing" (I assume something is not right) but I proceed to save the page.

    When I go visit the page I now see "

    The page cannot be found

    The page you are looking for might have been removed, had its name changed, or is temporarily unavailable....."

    What did I do wrong and how how can I fix it?

    Thank you so much again.


  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Feb 20, 2010 @ 20:49
    Morten Bock
    0

    The iframe code that you get will have a scr attribute like so:

    <iframe src="http://example.com/someurl?blah=blah">....

    What you need to put in the location parameter is the value of the src attribute.

    Hope this helps.

    If not, could you paste the iframe code that you get from google? (just scramble any personal stuff in it)

  • Seth Niemuth 275 posts 397 karma points
    Feb 20, 2010 @ 22:45
    Seth Niemuth
    0

    Adding the macro shouldn't make it so that the page cannot be found. That seems like the page isn't publishing correctly. How about if you publish it? Or click the 'Republish Entire Site' (Right click 'Content').

    Yes, you are correct to make the src parameter 'text'.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Feb 20, 2010 @ 23:40
    Morten Bock
    0

    Seth, I think the 404 message is shown in the iFrame?

  • Christophe 23 posts 43 karma points
    Feb 21, 2010 @ 05:33
    Christophe
    0

    Thanks I got it to work, although I am too satisfied with the way Google calendar comes up on my page.

    The iframe code (which works now I put "http://..." in location) is:

    <iframe src="http://www.google.com/calendar/embed?height=250&amp;wkst=1&amp;bgcolor=%23cccccc&amp;src=MyUsername%40gmail.com&amp;color=%232952A3&amp;ctz=America%2FNew_York" style=" border-width:0 " width="290" height="250" frameborder="0" scrolling="no"></iframe>

    I may opt to use one of those flash calendars, they look okay.

    Thanks again

  • Funka! 398 posts 661 karma points
    Sep 09, 2011 @ 00:58
    Funka!
    0

    Thank you Seth for your answer a year ago to this topic, as I have been trying the same thing this week and found your sample XSLT and macro idea to work great.

    However---and hence the reason I'm posting here---I found that I had to change the xsl:output node to "html" instead of "xml", or else the IFRAME tag was rendered as a "self-closing" tag instead of as separate opening and closing tags. For example, generating "<iframe ... />" would mess up my page, instead of "<iframe ...></iframe>" which is correct way to do this.

    I also wanted to post for posterity a link to this page I found in the wiki, which details alternate ways of doing this: Stop HTML tags from self-closing . For me just changing the output type did not have any drawbacks, so seemed the easiest way to do this.

     

Please Sign in or register to post replies

Write your reply to:

Draft