anchors in rss feed
Moderator: Thorsten
anchors in rss feed
The rss feed provides the link for the *page* only. In a list of five articles, all link to the main page. It would be dramatically better if the individual links led directly to the particular story.
Hi,
th RSS feeds provide links to the article in version 1.5.x
bye
Thorsten
th RSS feeds provide links to the article in version 1.5.x
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
rss feed
Really? I am currently uising 1.5.3. The rss feed sends out exactly the same link for all items in the list of news stories.
Here is the code (feed/news/rss.php, line 54), I believe:
The link does not seem to include any identifier that is specific to a particular news story.
But, if it is changed to this:
and a corresponding change is made to add the anchor to the news script, it works fine.
For example, test this link (with the anchor): http://westport.dumais.us/staplesfaq/index.php#43
Thanks!,
CD
Here is the code (feed/news/rss.php, line 54), I believe:
Code: Select all
$rss .= "\t\t<link>http".(isset($_SERVER['HTTPS']) ? 's' : '')."://".$_SERVER["HTTP_HOST"].str_replace ("/feed/news/rss.php", "", $_SERVER["PHP_SELF"])."</link>\n";
But, if it is changed to this:
Code: Select all
$rss .= "\t\t<link>http".(isset($_SERVER['HTTPS']) ? 's' : '')."://".$_SERVER["HTTP_HOST"].str_replace ("/feed/news/rss.php", "", $_SERVER["PHP_SELF"])."/index.php#".$row->id."</link>\n";
For example, test this link (with the anchor): http://westport.dumais.us/staplesfaq/index.php#43
Thanks!,
CD
Hi,
you're right... I'll add this!
bye
Thorsten
you're right... I'll add this!
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Modified Version of News RSS Feed
Thorsten,
Instead of using page anchors, I have modified main.php, function.php, and rss.php to display a single news article on the page. What do you think?
In inc/functions.php find
and change it to
In main.php find
and change it to
In feed/news/rss.php find
and change it to
Instead of using page anchors, I have modified main.php, function.php, and rss.php to display a single news article on the page. What do you think?
In inc/functions.php find
Code: Select all
function generateNews()
{
global $db, $PMF_LANG, $PMF_CONF;
$counter = 0;
$result = $db->query("SELECT datum, header, artikel, link, linktitel, target FROM ".SQLPREFIX."faqnews ORDER BY datum desc");
$output = "";
Code: Select all
function generateNews($lang,$id)
{
global $db, $PMF_LANG, $PMF_CONF;
$counter = 0;
$id==0 ? $result = $db->query("SELECT datum, header, artikel, link, linktitel, target FROM ".SQLPREFIX."faqnews ORDER BY datum desc") : $result = $db->query("SELECT id, datum, header, artikel, link, linktitel, target FROM ".SQLPREFIX."faqnews WHERE id=".$id."");
$output = "";
Code: Select all
if (!defined('IS_VALID_PHPMYFAQ')) {
header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
exit();
}
$tpl->processTemplate ('writeContent', array(
'writeNewsHeader' => $PMF_CONF['title'].$PMF_LANG['msgNews'],
'writeNews' => generateNews($LANGCODE),
'writeNumberOfArticles' =>
Code: Select all
if (!defined('IS_VALID_PHPMYFAQ')) {
header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
exit();
}
if (!isset($_GET['id'])) {
$id=0;
}
$tpl->processTemplate ('writeContent', array(
'writeNewsHeader' => $PMF_CONF['title'].$PMF_LANG['msgNews'],
'writeNews' => generateNews($LANGCODE, $id),
'writeNumberOfArticles' =>
Code: Select all
$rss .= "\t<item>\n";
$rss .= "\t\t<title><![CDATA[".$row->header."]]></title>\n";
$rss .= "\t\t<description><![CDATA[".stripslashes($row->artikel)."]]></description>\n";
$rss .= "\t\t<link>http".(isset($_SERVER['HTTPS']) ? 's' : '')."://".$_SERVER["HTTP_HOST"].str_replace ("/feed/news/rss.php", "", $_SERVER["PHP_SELF"])."</link>\n";
$rss .= "\t\t<pubDate>".makeRFC822Date($row->datum)."</pubDate>\n";
$rss .= "\t</item>\n";
Code: Select all
$rss .= "\t<item>\n";
$rss .= "\t\t<title><![CDATA[".$row->header."]]></title>\n";
$rss .= "\t\t<description><![CDATA[".stripslashes($row->artikel)."]]></description>\n";
$rss .= "\t\t<link>http".(isset($_SERVER['HTTPS']) ? 's' : '')."://".$_SERVER["HTTP_HOST"].str_replace ("/feed/news/rss.php", "", $_SERVER["PHP_SELF"])."/index.php?id=".$row->id."</link>\n";
$rss .= "\t\t<pubDate>".makeRFC822Date($row->datum)."</pubDate>\n";
$rss .= "\t</item>\n";
Hi,
we're already implemented a new news class for phpMyFAQ 1.6. Thanks for your proposal...
bye
Thorsten
we're already implemented a new news class for phpMyFAQ 1.6. Thanks for your proposal...
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist