Jump to content

RSS php atom mysql


jalmz

Recommended Posts

Hi guys,

 

im having problem on how to insert this code ...

<atom:link href="######" rel="self" type="application/rss+xml" />

 

 

<?php

/**
A.R.A Class
RSS Builder
(c) 2007 Denis Sureau
http://www.scriptol.com/rss/

API for creating RSS 2.0 feeds
Licence GNU GPL 2.
*/


// Create a feed
// Returns the XML document


class ara
{
public $doc;
public $rss;
public $channel;

function ARAMakeTag($tagname, $str)
{
	$tag= $this->doc->createElement($tagname);
	$data= $this->doc->createTextNode($str);
	$tag->appendChild($data);

	return $tag;
}

public function ARAFeed($title, $link, $desc, $date)
{
	$this->doc = new DOMDocument("1.0", "UTF-8");
	$this->doc->formatOutput = true;

	$this->rss = $this->doc->createElement("rss");
	$this->rss->setAttribute("version", "2.0");
	$this->rss->setAttribute("xmlns:atom", "http://www.w3.org/2005/Atom");
	$this->doc->appendChild($this->rss);

	$this->channel = $this->doc->createElement("channel");
	$this->rss->appendChild($this->channel);

	$this->channel->appendChild($this->ARAMakeTag("title", $title));
	$this->channel->appendChild($this->ARAMakeTag("link", $link));
	$this->channel->appendChild($this->ARAMakeTag("description", $desc));
	$this->channel->appendChild($this->ARAMakeTag("pubDate", $date));

}

public function ARAItem( $title, $id, $cid, $desc, $date)
{
	$item = $this->doc->createElement("item");

	$item->appendChild($this->ARAMakeTag("title", $title));	
	$item->appendChild($this->ARAMakeTag("link", "####"));	
  $item->appendChild($this->ARAMakeTag("guid", "#####"));	
  	$item->appendChild($this->ARAMakeTag("description", $desc));	
	$item->appendChild($this->ARAMakeTag("pubDate", $date));	

	$this->channel->appendChild($item);
}

public function save($fname)
{
	$this->doc->save($fname);
}

public function saveXML()
{
	return $this->doc->saveXML();
}

}

?>

 

 

i would like to add this code to validate my rss feed..

 

<atom:link href="http://dallas.example.com/rss.xml" rel="self" type="application/rss+xml" />

 

thanks in advance guys..

 

Link to comment
Share on other sites

heres the output..

 

<?xml version="1.0" encoding="UTF-8"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
  <channel> 
    <title>eJalmz Feed</title> 
    <link>http://#####</link> 
    <description>eJalmz RSS Feed</description> 
    <pubDate>Thu, 24 Feb 2011 01:17:14 +0000</pubDate> 
    <item> 
      <title>Nikon D200</title> 
      <link>http://###</link> 
      <guid>http://####</guid> 
      <description>Pro-level D-SLR featuring a high performance 10.2-MP DX-format CCD, Nikon's exclusive Image Processing Engine and continuous...</description> 
      <pubDate>Sat, 19 Feb 2011 07:28:08 +0000</pubDate> 
    </item> 
    <item> 
      <title>Nexus S from Google</title> 
      <link>http://#####</link> 
      <guid>http://#####</guid> 
      <description>Android 2.3 OS (Gingerbread)&#13;
Gingerbread is the most advanced Android operating system available. In Google's ongoing quest...</description> 
      <pubDate>Sat, 19 Feb 2011 07:18:13 +0000</pubDate> 
    </item> 
    <item> 
      <title>Apple iphone 4 Black (16GB)</title> 
      <link>http://#####</link> 
      <guid>http://#####</guid> 
      <description>At just 9.3mm, the iPhone 4 is thin as a rake but the front and back are 30 times stronger than the usual plastic. Reason -...</description> 
      <pubDate>Wed, 16 Feb 2011 17:06:35 +0000</pubDate> 
    </item> 
  </channel> 
</rss>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.