Jump to content

Use PHP to include image in RSS


dachshund

Recommended Posts

Does anyone know how to use PHP to include an image in an RSS feed.

 

Currently I'm using PHP to write my RSS feeds title, link, description etc, but i can't work out how to include an image like this:

 

feed://www.itsnicethat.com/index.php?rss=1

 

My code so far is

<?php 
header("Content-type: text/xml"); 
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<rss version=\"2.0\">"; 

echo "<channel> 
    <title></title> 
    <description></description> 
    <link></link>";  
?>

<?php
   session_start();
   
   $connect= mysql_connect ("", "", "") or die(mysql_error());
   $db = mysql_select_db ("", $connect);
   
   $session_name = $_SESSION['uid'];
?>

<?

    $data = mysql_query("SELECT * FROM entries ORDER BY id DESC LIMIT 10"); 
    while($row = mysql_fetch_array($data))

  echo "<item> 
      <link>view_post.php?id=".$row['id']."</link> 
      <guid isPermaLink=\"true\">view_post.php?id=".$row['id']."</guid> 
      <title>".$row['title']."</title> 
      <description><![CDATA[".$row['condensedpost']."]]></description>
    </item>";
echo "</channel> </rss>";
?>


 

obviously all the database connection fields are filled in, i've just taken them out for this post.

 

Any help would be greatly appreciated. Cheers.

 

 

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.