开发者

How to embed and display Google Calendar in Zotonic the Erlang CMS

I'd like to be able to save an iframe of a Google Calendar as a media item and then attach it to a resource. I haven't been able to get this working.

开发者_Go百科

I saved the iframe code as a media item, selecting embedded code and choosing 'Other' I created a rsc and attached this media item to it. I'm either not referring to it correctly in the template or the item is not being stored properly. Can someone shed some light on how to do this. I apologize if this is a simple thing, but I just can't seem to figure this one out.

Much appreciation.

Jeff


Solved:

I was just getting confused on exactly how to save the media item and reference it in the template. I'm open to suggestions or comments for this solution.

  1. From my Google Calender settings, I copied the embed code (this could be a private or public calendar)
  2. In Zotonic I created a category called Calendar
  3. I added a new media item. I selected "Embed code", entered a title, selected Other for "From site" and pasted code. This was assigned id 387.
  4. I changed the category of this media item to be Media->Document and save the item.
  5. I added a rsc page and selected category calendar. This page's id was 388 and slug "building-project"
  6. I attached the media item that I saved earlier to this rsc and save the item.

I have a local dispatch that maps to something like this /calendars/[id]/[slug]

{calendar_details, ["calendar", id, slug], resource_page, [ {template, "calendar_details.tpl"}, {cat, calendar} ]},

Under Advanced for this page I changed the Page path to match my resource with something like this /calendars/388/building-project

In my calendars_details.tpl I referenced this media item by this

 {% for m in  m.rsc[id].media %} {# this returns a list of the media attached.  Unfortunately I'm assuming only one item returned [387] #}
   {% media m %} {# apply the media tag to the elements in this list, ie  media 387 #}
 {% endfor %}

I know this seems simple and straight forward, but if anyone else is as challenged as I am, they may find this useful :)

Thanks for a great framework!

Jeff

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜