Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
I was researching the forum to learn how to embed a sidebar video tag so my client can add these type ads on their website...I stumbled across Tim's solution :backend
Code: Select all
<cms:editable name='youtube_id' label='YouTube Video ID' type='text' col_width='150' input_width='100' />[/color]

Frontend:
Code: Select all
<iframe width="560" height="315" src="//www.youtube.com/embed/<cms:show youtube_id />" frameborder="0" allowfullscreen></iframe>[color=#FFFF40][/color]


However when I drop my Youtube Id into the frontend and check the video it doesnt play the video just says "ERROR"....I did switch my type to "textarea"
Please do a view:source and see the generated HTML code. Does the "<cms:show youtube_id />" output the video ID you inputted in the admin-panel?

If not, try to find the reason e.g. is the code being used in page-view etc.

Hope it helps.
One of the things I noticed in list view was there were 4 youtube embeds in the sidebar not one.I will run a view source ..Thank you
This is showing up when I click view page source and seems to be pulling my Youtube ID
Code: Select all
<div class="sidebar-video">
            <iframe width="400" height="335" src="https://www.youtube.com/embed/https://youtu.be/9MmY3izUmFM" frameborder="0" allowfullscreen></iframe>
            
            </div>


This is the code I have used in my template
Code: Select all
<div class="sidebar-video">
      <iframe width="400" height="335" src="https://www.youtube.com/embed/<cms:show youtube_id />" frameborder="0" allowfullscreen></iframe>
            
            </div>


Code: Select all
<cms:editable name='youtube_id' label='YouTube Video ID' type='textarea' width="400" height="335" />
I guess Ive just noticed the other issue lol.When I add an editable area in list view on cloned pages it adds another to the pageview....If I add an image to one page,,,add another separate image to another page then in list view all the images show up...I would like it for just one image shows up on the list view or block
Regarding the video embed issue, the source code from the browser shows what the problem is.

"https://www.youtube.com/embed/https://youtu.be/9MmY3izUmFM" is not a valid url. The code snippet you used is meant to take only the video id - the string of numbers and letters - not the full path to the video.

Another way to do this is to allow your client to copy and paste the full embed code from YouTube. That way they can use YouTube's tools to customize the size and other things. For that you should use a textarea with the no_xss_check like this:

Code: Select all
<cms:editable name='videolink' label='Upload YouTube Embed Code' type='textarea' no_xss_check='1' />

Using <cms:show videolink /> on the front end will output the entire embed code.

I think this could be a better way to do it.
Worked great Tim...Thank you once again for your help....
7 posts Page 1 of 1