thesprucegoose Posted October 30, 2008 Share Posted October 30, 2008 Hey, I'm attempting to create a geoRSS feed by creating a parser that scans an image gallery and adds those images to an RSS Feed. The code below is what I have so far. When I run it, I get the following error: Parse error: syntax error, unexpected T_VARIABLE in /home/content/n/k/8/nk86snyder/html/test_feed.php on line 14 The file test_feed.php is in the root directory. Any ideas? <?php class rss2 extends DomDocument { private $channel; public function __construct($title, $link, $description) { parent::__construct(); $this->formatOutput = true; $root = $this->appendChild($this->createElement('rss')); $root->setAttribute('version', '2.0') $channel = $root->appendChild($this->createElement('channel')); $channel->appendChild($this->createElement('title', $title)); $channel->appendChild($this->createElement('link', $link)); $channel->appendChild($this->createElement('description', $description)); $this->channel = $channel; } public function addItem($title, $link, $description) { $item = $this->createElemenet('item'); $item->appendChild($this->createElement('title', $title)); $item->appendChild($this->createElement('link', $link)); $item->appendChild($this->createElement('description', $description)); $this->channel->appendChild($item); } } $rss = new rss2('Channel Title', 'http://digg.com', 'Channel Description'); $rss->addItem('Digg', 'http://digg.com/', 'Digg'); $rss->addItem('Digg Tech', 'http://digg.com/technology', 'Digg Tech'); print $rss->saveXML(); ?> <?xml version="1.0"?> <rss version="2.0"> <channel> <title>Testing The RSS</title> <link>http://www.digg.com</link> <description>Diggggggggg</description> <item> <title>Digg Technology</title> <link>http://digg.com/technology</link> <description>Digg Tech</description> </item> </channel> </rss> Thanks, ~TSG Link to comment https://forums.phpfreaks.com/topic/130772-creating-rss-feeds-from-html-files-help-code-included/ Share on other sites More sharing options...
trq Posted October 30, 2008 Share Posted October 30, 2008 Missing ; at the end of.... $root->setAttribute('version', '2.0') Link to comment https://forums.phpfreaks.com/topic/130772-creating-rss-feeds-from-html-files-help-code-included/#findComment-678888 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.