Forum Moderators: open
I'm having some problems showing Rss in my address bar for my site.
The Rss is validated and is at www.example.com/test.php
I just want to show the icon in the address bar that show we have rss for our latest pictures and news.
What am i missing?
Thanks for the help. Ehrin
Oh yeah my PHP is:
<?
include( "database.php" );
$photoLimit =40;
$gallery_result = mysql_query("SELECT * FROM photo_galleries where pub_pri = '0'", $db);
$gallery_rows = mysql_num_rows($gallery_result);
while($gallery = mysql_fetch_object($gallery_result)){
$approved_cats[] = $gallery->id;
}
$approved_cats = implode(", ", $approved_cats);
$package_result = mysql_query("SELECT * FROM photo_package where active = '1' and gallery_id IN ($approved_cats) order by 'id' desc LIMIT $photoLimit", $db);
$package_rows = mysql_num_rows($package_result);
header('Content-type: text/xml;');
echo "xml version=\"1.0\" encoding=\"utf-8\"\n\n";
echo"<rss version=\"2.0\">";
echo"<channel>";
echo"<title>example.com's Newest photos RSS</title>";
echo"<link>http://www.example.com/index.php</link>";
echo"<description>Latest 40 images from example.com</description>";
while($package = mysql_fetch_object($package_result)){
$photo_result = mysql_query("SELECT * FROM uploaded_images where reference = 'photo_package' and reference_id = '$package->id'", $db);
$photo_rows = mysql_num_rows($photo_result);
$photo = mysql_fetch_object($photo_result);
$ptgm_result = mysql_query("SELECT * FROM photographers where id = '$package->photographer'", $db);
$ptgm_rows = mysql_num_rows($ptgm_result);
$ptgm = mysql_fetch_object($ptgm_result);
?>
<item>
<author>support@example.com</author>
<guid isPermaLink="true">http://www.example.com/details.php?gid=<?=$_GET['gid'];?>&sgid=<?=$_GET['sgid'];?>&pid=<?=$package->id;?></guid>
<title>Photo Title: "<?=$package->title;?>" By: <?=$ptgm->name;?></title>
<link>http://www.example.com/details.php?gid=<?=$_GET['gid'];?>&sgid=<?=$_GET['sgid'];?>&pid=<?=$package->id;?></link>
<description>Description: <?=$package->description;?></description>
</item>
<!-- <image>
<url>http://www.example.com/image.php?src=<?=$package->id;?></url>
<title>http://www.example.com/details.php?gid=<?=$_GET['gid'];?>&sgid=<?=$_GET['sgid'];?>&pid=<?=$package->description;?></title>
<link>http://www.example.com/details.php?gid=<?=$_GET['gid'];?>&sgid=<?=$_GET['sgid'];?>&pid=<?=$package->id;?></link>
</image> -->
<?
}
?>
</channel>
</rss>
[edited by: bill at 8:09 am (utc) on April 16, 2007]
[edit reason] Removed site specifics - Use example.com [/edit]
Generally to get the browser to see that you have a feed you need to have something like the following being returned in the <head> of your HTML or PHP page:
<link rel="alternate" type="application/atom+xml" title="Atom" href="http://example.com/atom.xml" />
<link rel="alternate" type="application/rss+xml" title="RSS 1.0" href="http://example.com/index.rdf" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://example.com/index.xml" /> You don't have to have all of these (These are for an XHTML document.), but at least one would indicate to a modern browser that there's a feed available. Different browsers indicate feed availability differently though. (Not always in the Address Bar.)