Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Read and display Youtube Video Feeds with 3.17

 
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
jacz
Smarty Pro


Joined: 13 Nov 2010
Posts: 249

PostPosted: Mon Jan 16, 2012 12:43 pm    Post subject: Read and display Youtube Video Feeds with 3.17 Reply with quote

So as the other two tricks it is very simple code - only change ARD to the youtube screenname you want.

Code:


{$yt=simplexml_load_file('http://gdata.youtube.com/feeds/api/users/ARD/uploads')}
{foreach $yt->entry as $e}
{foreach $e->link->attributes() as $k=> $a}
{if $k=='href'}
{$e->title|default:'No Title'}<br/>{$e->content|default:'No Description'}<br/>
<p><a href="{$a[0]}">Zum Video</a></p><hr/>
{/if}
{/foreach}
{/foreach}
Back to top
View user's profile Send private message Visit poster's website
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 698
Location: Germany, border to Switzerland

PostPosted: Mon Jan 16, 2012 1:04 pm    Post subject: Reply with quote

Seeing this and the previous five hundred posts about simple_xml_loadfile()…
Maybe you just want to write a plugin for embed.ly - using the oEmbed "standard". You can still pipe their results through a smarty template, but it shouldn't be necessary.

after all, {embed src="http://www.youtube.com/watch?v=U35O2Zd63AE" width="400" height="300"} seems a bit more straight forward (and might be made compatible with any bbcode/markdown/whatever markup you allow your users to input).

Yes, I'm using oEmbed. No, I don't have a smarty plugin for that since I've never had a reason to embed something on a template level. But… you obviously have that need, so knock yourself out…
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
jacz
Smarty Pro


Joined: 13 Nov 2010
Posts: 249

PostPosted: Mon Jan 16, 2012 1:26 pm    Post subject: Reply with quote

This is only a linear raw list without an extension to display a video in the own website.
Demo is here http://powercms.org/?366 at the end of the page.
You see very long descriptions of the owner in this example and you can decide to view it or not.

If someone wishes to show the videos onpage the best method is to use ajax and not to display all videos to start it onclick directly via embed or so, because this makes a page very slow - we have max 25 videos in the list.
Back to top
View user's profile Send private message Visit poster's website
jacz
Smarty Pro


Joined: 13 Nov 2010
Posts: 249

PostPosted: Mon Jan 16, 2012 5:20 pm    Post subject: Apple Affiliates Reply with quote

If you want to make this: http://www.apple.com/itunes/affiliates/resources/documentation/basic-linking.html
with rss feed you can use the same code - change only the source.


Example http://powercms.org/?366
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP