Adding YouTube iframe code via the admin

2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 12, 2013   (RSS)

By csdesign - April 11, 2013 - edited: April 11, 2013

Hello! I have what I hope is a super easy... and probably very obvious question.  I've done this before but now I can't get it to work. 

I want to enable the admin to be able to grab the iframe or embed code from youtube and then have that video appear on the page.  I realize the problem is that the iframe code I enter is not being interpreted as code, but rather as text but I'm not sure how to fix it. 

Here's an example iframe code: 

<iframe width="480" height="360" src="http://www.youtube.com/embed/tys92pFGKOE?rel=0" frameborder="0" allowfullscreen></iframe>

I've entered that info the Video Embed field in the admin but it just appears on the page exactly as it does above. 

Here's the code I was using in my page: 

<?php echo htmlencode($horses_for_saleRecord['youtube_embed_code']) ?>

I tried variations like "urlencode" and even changed the field to WYSIWYG and entered it as html there.  I also tried as a text box and checked "Disable auto-formatting (don't add break tags to content". that didn't work either.  This is how it's showing up in the source code on the page once it's online.  Right below it is one I entered manually into the php page.  You can see the obvious difference between the two: 

generated by cms:
&lt;p&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/tys92pFGKOE?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/p&gt;

entered by hand:
<iframe width="480" height="360" src="http://www.youtube.com/embed/tys92pFGKOE?rel=0" frameborder="0" allowfullscreen></iframe>

Some quick help would be GREATLY appreciated!! Thanks! Tina