Using an embed code from a data definition

Ashley Williams's Avatar

Ashley Williams

31 Aug, 2012 03:50 PM

We would like to use the data definition on our news article pages to include an area for a Flickr slideshow embed code. I've set up my data definition to use a multi-line text area to put the code in.

When I use this and then set my format to just display the input like so:

#set ( $flickr_slideshow = $content.getChild("flickr-slideshow").value)

I get the following error when trying to render the page:

An error occurred: Error on line 17: The reference to entity "lang" must end with the ';' delimiter.

My guess is that the Flickr emded code isn't validating and that I should figure out how to use it in such a way that our clients will be able to easily. However, if I just add it into the WYSIWYG area on the page as html, it works fine.

I tried the following to see if it would help:

#set ( $flickr_slideshow = $content.getChild("flickr-slideshow"))
$_SerializerTool.serialize($flickr_slideshow, false)

But then it just displays as text and not HTML (I also tried this using true, same effect?). Is there a way I can provide just a text area in the data definition and output it as HTML in a way that will work like the WYSIWYG does?

  1. 1 Posted by Ryan Griffith on 04 Sep, 2012 01:50 PM

    Ryan Griffith's Avatar

    Hi Ashley,

    If you are running Cascade 6.10+, let's try running the embed code through the EscapeTool to see if that helps out:

    #set ( $flickr_slideshow = $content.getChild("flickr-slideshow").value)

    By using the HTML escape method, hopefully the HTML will be encoded properly and the error will go away.

    Please let me know if you have any questions.


  2. 2 Posted by Ashley Williams on 04 Sep, 2012 05:43 PM

    Ashley Williams's Avatar

    Hi Ryan,

    It looks like using the EscapeTool got rid of the error, but it ends up putting the code on the page as text.

    I've attached the article format and xml for context.

  3. 3 Posted by Ryan Griffith on 04 Sep, 2012 06:56 PM

    Ryan Griffith's Avatar

    Thank you for the follow up and attaching the files for reference. Let's try the attached Velocity and see if that helps.

    The two lines I updated were:

    #set ( $flickr_slideshow = $content.getChild("flickr-slideshow"))

    I believe you had something similar initially, but instead of passing true into the serializer, you had false.

    Please let me know if you have any questions.


  4. 4 Posted by Ryan Griffith on 04 Sep, 2012 06:56 PM

    Ryan Griffith's Avatar

    My apologies, I forgot to attach the file.

  5. 5 Posted by Ashley Williams on 04 Sep, 2012 07:47 PM

    Ashley Williams's Avatar

    Hi Ryan,

    Still the same issue (it outputs as text instead of code) with the change you made. I think I may have tried the same thing (using true instead of false) on Friday.

    Maybe I'm not choosing the right method for having them paste in the embed code? In the data definition I'm using a multi-line textbox:

    <text multi-line="true" identifier="flickr-slideshow" label="Flickr Slideshow" help-text="Paste the embed code for the Flickr Slideshow here"/>
  6. 6 Posted by Ryan Griffith on 04 Sep, 2012 09:24 PM

    Ryan Griffith's Avatar

    Ah, that was something I was wondering. I think the issue from my example code was the text box isn't encoding the HTML and the Format was, resulting in the content being spit out to the page.

    Have you tried the following?

    #set ( $flickr_slideshow = $content.getChild("flickr-slideshow").value )

    On a side note, if you change the field to a WYSIWYG and use the Format from my post above that should fix the issue. The downside here is that your users will have to paste the code into the HTML Source.

    Another, more complicated, option could be to adjust your Data Definition and Format to build the embed code on the fly, similar to what is done on this page in our knowledgebase.

    It looks like the flashvars attribute contains a few constants offsite=true&lang=en-us plus the URL to the show minus the Flickr domain at the beginning photos/valdostastate/sets/72157630730541542/show so it could be doable.

    Please let me know if you have any questions.


  7. 7 Posted by Ashley Williams on 05 Sep, 2012 12:18 PM

    Ashley Williams's Avatar


    That worked! :) I considered the more complicated option, but I think this method will be easier while we're importing from another database. Thank you!

  8. 8 Posted by Ryan Griffith on 05 Sep, 2012 12:21 PM

    Ryan Griffith's Avatar

    That is great news, Ashley. Glad to her we got it working.

    I'm going to go ahead and close this discussion, please feel free to reply or comment to re-open this discussion if you have any additional questions.


  9. Ryan Griffith closed this discussion on 05 Sep, 2012 12:21 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac