YouTube APIs and Tools
Read more here http://code.google.com/apis/youtube/getting_started.html
A video widget fro your blog
<div style="text-align:center;">
<object width="480" height="385">
<param name="movie" value="http://www.youtube.com/v/d9_kjdcA9Pc&hl=en_US&fs=1&" />
<param name="allowFullScreen" value="true" />
<param name="allowscriptaccess" value="always" />
<embed src="http://www.youtube.com/v/d9_kjdcA9Pc&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="280" height="185">
</embed>
</object>
<div style="color:#FFFFFF;text-align:center;height:18px;margin-top:3px;">
<a href="http://www.lifewidget.com"></a>
</div>
</div>
Display CDATA with XSL
I've been playing around with it and there's something I can't figure out.
The XML is based of an RSS Feed. Here's a example of XML I am trying to play with.
<item>
<title>Dinner at Chilis</title>
<link></link>
<description>
[!CDATA[<div><b>Location:</b> Chilis </div>
<div><b>Start Time:</b> 4/21/2010</div>
<div><b>Description:</b> Dinner at Chilis </div>]]>
</description>
</item>
Here's a part of the XSL I've been playing around.
<xsl:template match="item">
<xsl:value-of select="title"/>
<xsl:value-of disable-output-escaping="yes" select="substring-before(substring-after(description, ']]'), '[CDATA[') "/>
</xsl:template>
I'm not sure why it's not displaying the string.
My previous code was like this:
<xsl:template match="item">
<xsl:value-of select="title"/>
<xsl:value-of disable-output-escaping="yes" select="description"/>
</xsl:template>
It displays, but I won't have control on how to select the specific text in the description tag.
It's something I want to learn how to do it. I'm still a beginner in XSL so my apologies for being a newbie.
EDIT*
Ok. I got it.
It displays only the first line though. lol. Here's the code I have right now.
<xsl:template match="item">
<xsl:value-of select="title"/>
<xsl:value-of disable-output-escaping="yes" select="substring-before(substring-after(description, '<div>'), '</div>') "/>
</xsl:template>
So far so good. I'll play around a bit more.
libxml writer - XML writer
<?php
// THIS IS ABSOLUTELY ESSENTIAL - DO NOT FORGET TO SET THIS
@date_default_timezone_set("GMT");
$writer = new XMLWriter();
// Output directly to the user
$writer->openURI('php://output');
$writer->startDocument('1.0');
$writer->setIndent(4);
// declare it as an rss document
$writer->startElement('rss');
$writer->writeAttribute('version', '2.0');
$writer->writeAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom');
$writer->startElement("channel");
//----------------------------------------------------
//$writer->writeElement('ttl', '0');
$writer->writeElement('title', 'Latest Products');
$writer->writeElement('description', 'This is the latest products from our website.');
$writer->writeElement('link', 'http://www.domain.com/link.htm');
$writer->writeElement('pubDate', date("D, d M Y H:i:s e"));
$writer->startElement('image');
$writer->writeElement('title', 'Latest Products');
$writer->writeElement('link', 'http://www.domain.com/link.htm');
$writer->writeElement('url', 'http://www.iab.net/media/image/120x60.gif');
$writer->writeElement('width', '120');
$writer->writeElement('height', '60');
$writer->endElement();
//----------------------------------------------------
//----------------------------------------------------
$writer->startElement("item");
$writer->writeElement('title', 'New Product 8');
$writer->writeElement('link', 'http://www.domain.com/link.htm');
$writer->writeElement('description', 'Description 8 Yeah!');
$writer->writeElement('guid', 'http://www.domain.com/link.htm?tiem=1234');
$writer->writeElement('pubDate', date("D, d M Y H:i:s e"));
$writer->startElement('category');
$writer->writeAttribute('domain', 'http://www.domain.com/link.htm');
$writer->text('May 2008');
$writer->endElement(); // Category
// End Item
$writer->endElement();
//----------------------------------------------------
// End channel
$writer->endElement();
// End rss
$writer->endElement();
$writer->endDocument();
$writer->flush();
?><?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Latest Products</title>
<description>This is the latest products from our website.</description>
<link>http://www.domain.com/link.htm</link>
<pubDate>Thu, 10 Jul 2008 11:47:14 GMT</pubDate>
<image>
<title>Latest Products</title>
<link>http://www.domain.com/link.htm</link>
<url>http://www.iab.net/media/image/120x60.gif</url>
<width>120</width>
<height>60</height>
</image>
<item>
<title>New Product 8</title>
<link>http://www.domain.com/link.htm</link>
<description>Description 8 Yeah!</description>
<guid>http://www.domain.com/link.htm?tiem=1234</guid>
<pubDate>Thu, 10 Jul 2008 11:47:14 GMT</pubDate>
<category domain="http://www.domain.com/link.htm">May 2008</category>
</item>
</channel>
</rss>