Welcome to WebmasterWorld Guest from 107.22.87.205

Forum Moderators: bill & werty

Message Too Old, No Replies

Valid Rss 2.0 but not showing in address bar

Need some help with PHP rss not showing in address bar

     
8:01 am on Apr 16, 2007 (gmt 0)

5+ Year Member



Hey all,

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'];?>&amp;sgid=<?=$_GET['sgid'];?>&amp;pid=<?=$package->id;?></guid>
<title>Photo Title: &quot;<?=$package->title;?>&quot; By: <?=$ptgm->name;?></title>
<link>http://www.example.com/details.php?gid=<?=$_GET['gid'];?>&amp;sgid=<?=$_GET['sgid'];?>&amp;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'];?>&amp;sgid=<?=$_GET['sgid'];?>&amp;pid=<?=$package->description;?></title>
<link>http://www.example.com/details.php?gid=<?=$_GET['gid'];?>&amp;sgid=<?=$_GET['sgid'];?>&amp;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]

8:23 am on Apr 16, 2007 (gmt 0)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld emacksey.

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.)

10:30 am on Apr 16, 2007 (gmt 0)

5+ Year Member



Thank you very much for answering this for me. I have been trying tho figure this out for some time.

Also thanks for clearing out my site names. I must have had a relapse in thought when I posted that.

Thanks again,
Ehrin

 

Featured Threads

Hot Threads This Week

Hot Threads This Month