Search

A new extension, “YouTube Videos” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

This is an extension that allows you to integrate YouTube videos into your sections. It’s based on Nick Dunn’s Vimeo extension.

Field Output

YouTube field output

Playing with thumbs

YouTube provides you 4 thumbnails in 2 different sizes. This is a part of a video feed that represents the thumbnails:

<media:thumbnail url="http://i.ytimg.com/vi/vbMni2-ZLLo/2.jpg" height="90" width="120" time="00:02:18.500"/>
<media:thumbnail url="http://i.ytimg.com/vi/vbMni2-ZLLo/1.jpg" height="90" width="120" time="00:01:09.250"/>
<media:thumbnail url="http://i.ytimg.com/vi/vbMni2-ZLLo/3.jpg" height="90" width="120" time="00:03:27.750"/>
<media:thumbnail url="http://i.ytimg.com/vi/vbMni2-ZLLo/0.jpg" height="240" width="320" time="00:02:18.500"/>

Did you see the similarity between urls? It’s just that. Probably you’ll use something like that on your XSLT.

<img src="http://img.youtube.com/vi/{@video-id}/2.jpg" width="120" height="90"/>

Requirements

This extension wasn’t tested in older Symphony versions but I recommend you use the latest stable version.

Download

http://github.com/rainerborene/youtube_videos

Attachments:
youtube_output.png

Great addition! I’ll be using this one for sure in the future.

public static function getVideoFeed($video_id){
    return DOMDocument::load("http://gdata.youtube.com/feeds/api/videos/{$video_id}");
}

The method above will fail on my server. I think it would be more robust if you checked whether or not it fails, and if it does utilize CURL.

I installed this extension and I don’t get it to the frontend :( The content owns Greeting Text following by the youtube add on. In the backend under /symphony/publish/greetings/edit/2/ I can view the greeting with id 2 and its youtube video.

How can I make the youtube add on visible at the frontend?

Regards

You need to create a Data Source to select entries from your Greetings section. Then attach your DS to a Page, which will expose the entry data (including YouTube field) as XML (append ?debug to the URL of your page to see the XML). Then use XSLT to convert this XML into HTML. This HTML will probably need to build <object> and <embed> elements to embed the YouTube Flash player.

Ok, now I attached my screens. The Data Source exists but for 2 different entries in the content with two different videos I get for both the first youtube video. Moreover when I save the video urls and leave the administration and login again, the youtube video urls are empty.

What’s going wrong here?

Attachments:
screen4.gif, screen3.gif, screen2.gif and screen1.gif

@earls-it Can you show your page template?

Of course, here it goes:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

<xsl:template match="/">
  <html>
    <head>
      <title>Hello World!</title>
    </head>
    <body>
      <h1>earls greets the World</h1>

      <table>
        <xsl:apply-templates select="/data/greetings/entry"/>
      </table>

    </body>
  </html>
</xsl:template>

<xsl:template match="greetings/entry">
  <tr>
    <td>Entry #<xsl:value-of select="@id"/>: </td>
    <td><xsl:value-of select="greeting-text"/></td>
  </tr>
  <tr>
    <td colSpan="2"><xsl:value-of select="youtube-video"/></td>
  </tr>
</xsl:template>
</xsl:stylesheet>

Does any one here have an idea?

Interesting thing is, that during debugging all video data is available apart from the youtube video id that is empty!

No idea, really…

Your code seems to have the template outside of a html page!

Thus would not be seen on the front end!

Try placing your code for template match=”greetings/entry” before the closing html tag

The code is integrated by xsl into the html template. This can’t be the error. Anyway I tested your suggestion and it worked out an xslt processing error.

In the frontend everything can be seen apart from the youtube video id.

Do I need the “vimeo extension” to get it run? Hopeless cause.

@earls-it It looks that you’ve found a bug. I’ll take a look.

Do I need the “vimeo extension” to get it run? Hopeless cause.

No, you don’t need it.

@earls-it Remember that you are using XSLT and XML. You have to write the HTML embed code and then grab these values.

Take a look above at my code, please. I don’t think I did it in another way. Looks good to me…

If the above is your page template.. I would have thought that xslt would need to sit inside the html in order for it to be visible on the webpage..

Also having the embed method as raierborene mentions is necessary for the video’s to be seen.

EDIT I see how you have apply templates working.. wasn’t sure you could do it with the template match on the same page!

EDIT 2

Have you tried the template match = greetings and the ID written as entry/@id

EDIT 3

Ignore me - looks like video-id is missing from xml output.. is it attached in the DS?

If the video ID is missing from the debug XML then this issue lies with the extension and not your XSLT. Could you post a sample of the XML where the ID is missing please?

Nick I think gif file number 4 included with his post has the xml.. but better if it was pastie or actual code rather than image.

I just tried the extension and seem to be missing the video id in the outputted xml too.. 2.0.6 build.. bug?

IIRC, the video-id is an attribute of the field.

I’ve done some work on this extension and I think I remember that there is a bug with the caching. If you leave ‘blank’, the entry isn’t created in the database so you can’t save a video an entry properly.

Setting it something numeric fixed the problem for me as I never got around to actually fixing the bug.

Is somebody able to fix this extension bug? Would be very happy :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details