Page 1 of 1

RSS feed issue

Posted: Sun Jan 14, 2007 2:31 pm
by amiira
Hey all Dev:ers!

I have a little problem that i really need some help with:

I've done a RSS news feed and i've got a data base consisting of: id, title, description, link, content

Now, my php code (messy i know) looks like this:

Code: Select all

<?php
echo "<rss version='2.0'>";


echo "<channel>";
echo " <title>Skatan RSS</title>";
echo " <link>http://****/ds/index.php</link>";
echo"  <description>Nyheter</description>";
?>
<?php
    $query = "SELECT  id, title, description, link, content FROM nyheter";
    $result = mysql_query($query)
        or die("Query failed");
		
		 while ($line = mysql_fetch_object($result)) {
        // lagra innehÄllet i en tabellrad i variabler
        $id = $line->id;
		$title = $line->title;
		$description = $line->description;
		$description = str_replace('&', '&', $description);
		$link= $line->link;
		$link = str_replace(' ', '%20', $link);
		$content = $line->content;
		$description = str_replace('&', '&', $description);
		$stringen = $link . $id;
		?>
		
<item >
	
	<guid isPermaLink="false"><?php print utf8_encode($stringen);?></guid>
	
	<category>
	<?php print utf8_encode($content);?>	
	</category>
	
	<title>
	<?php print utf8_encode(nl2br($title));?>
	</title>

	<link>
	<?php print utf8_encode(nl2br($link));?>
	</link>

	<description>
	<?php print utf8_encode($description);?>
	</description>

	</item>
<?php
};

echo "</channel>";
echo "</rss>";
?>
My issue:

I want to be able to, from the RSS feed click on let's say title 2, then a php window with a little table with that specific new should open, containing its title, description and content...

what i have now is that a windows opens and lists ALL the news with title, contents etc... but i just want the specific one that i clicked on in the RSS feed page...

my XSL (also messy i know) looks like this:

Code: Select all

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:rss="http://purl.org/rss/1.0/"
                xmlns="http://www.w3.org/1999/xhtml"
                version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="rss">
   <html>
     <head>
       <title>
	   <xsl:value-of select="channel:title"></xsl:value-of>
	   </title>
     </head>
   
     <body>
		 <table>
		 <xsl:for-each select="rss:item">
		<tr>
		<td>
		<a href="{rss:link}"><xsl:value-of select="rss:title"></xsl:value-of></a>
		</td>
		</tr>
		<tr>
		<td>		
		<xsl:value-of select="rss:description"></xsl:value-of>
		</td>
		</tr>
		</xsl:for-each>
		</table>
	</body>
   </html>
</xsl:template>

</xsl:stylesheet>
and the php code for the "news page view" :

Code: Select all

<?php
    $query = "SELECT  id, title, description, link, content FROM nyheter";
    $result = mysql_query($query)
        or die("Query failed");
		
		 while ($line = mysql_fetch_object($result)) {
        // lagra innehÄllet i en tabellrad i variabler
        $id = $line->id;
		$title = $line->title;
		$description = $line->description;
		$description = str_replace('&', '&', $description);
		$link= $line->link;
		$link = str_replace(' ', '%20', $link);
		$content = $line->content;
		$content = str_replace('&', '&', $content);
		?>
<?php
print "	<main_window>";

print "<id>";
print utf8_encode(nl2br($id));
print "</id>";
		
print "	<title>";
print utf8_encode(nl2br($title));
print "</title>";

print "<link>";
print utf8_encode(nl2br($link));
print "</link>";
		
print "	</main_window>";
		
}
?>		
		
		
<?php
print "</page>";
?>

I know this is alot to ask, but plz help, and feel free to reconstruct anything...

Cheers!
Amiira[/list][/list]

RSS feed issue

Posted: Sun Jan 14, 2007 2:49 pm
by amiira
you can check the site at:

http://prozaac.homeftp.net/ds/rss.php

and then just select a news, this might illustrate more what i have...and what i want...

cheers!

Posted: Sun Jan 14, 2007 3:23 pm
by amiira
basically i want to know how to construct a link with the ?showtopic at the end... where the id of the news is after showtopic