News module RSS feed do not work in 0.11 ?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Didier LIROULET

News module RSS feed do not work in 0.11 ?

Post by Didier LIROULET »

Hi.

I want to create a RSS feed for news, and i have inserted call to news module in home page of my site like this, as said in docs:

{cms_module module="news" number="10"  makerssbutton="true"}

However, when i try to connect with Thunderbird, it tell me this is not a valid RSS feed.

When i browse the link with Firefox, i only get text format, not XML.

Do i have missed something ?

PS: You can check the site http://cms.dliroulet.pointclark.net. That's my last problem before putting CMS in production for OCS Inventory NG project.

Kind regards
alex7575

Re: News module RSS feed do not work in 0.11 ?

Post by alex7575 »

Bonsoir didier, ca n'a rien avoir avec ta question ms en voyant ton site j'ai la page "Copies d'écran". Tu as fais un template pour cette page ou tu l'as fais en "dur" à la main? :)
si tu as fais un template, pourrais tu nous faire partager la source stp?
en tout cas joli site ;)
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: News module RSS feed do not work in 0.11 ?

Post by Ted »

Very strange.  Yeah, you're correct.  It doesn't validate, but I'm not sure why it's not working correctly.  I tested this about a month ago and it was fine.

I'll look into it, though, Safari does display it correctly.  :)
Piratos

Re: News module RSS feed do not work in 0.11 ?

Post by Piratos »

Test this template:

Code: Select all


<rss version='2.0'
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>CMS Made Simple News Feed</title>
		<link>{$root_url}</link>
		<description>Current News entries</description>
		{foreach from=$items item=entry}
		<item>
			<title>{$entry->title}</title>
			<pubDate>{$entry->gmdate}</pubDate>
			<category>{$entry->category}</category>
			<description>{$entry->strippedsummary}</description>
			<content:encoded><![CDATA[{$entry->strippedcontent}]]></content:encoded>
		</item>
		{/foreach}
	</channel>
</rss> 

Template corrected !
Last edited by Piratos on Thu Dec 08, 2005 6:10 pm, edited 1 time in total.
Didier LIROULET

Re: News module RSS feed do not work in 0.11 ?

Post by Didier LIROULET »

Bonsoir Alex7575.

Non, je n'ai pas encore pris le temps de faire un template. C'est fait à la main.

Désolé  >:(

Peut-être un jour...
westis

Re: News module RSS feed do not work in 0.11 ?

Post by westis »

Please only use English in the English forums, so that everyone reading here can understand. For French instead use the French forum. :)
Piratos

Re: News module RSS feed do not work in 0.11 ?

Post by Piratos »

I have a separate script that makes a newsfeed.

The output look as example like so:

Code: Select all

<RDF>
<channel>
<title>Backend zum Newsmodul CMSMadeSimple von piratos</title>
<link>http://localhost/011/index.php
<description>Dieses Dokument enthält die Schlagzielen von Piratos</description>
<language>de_de</language>
<copyright>Jan Czarnowski piratos@coftware.de</copyright>
<lastBuildDate>08.12.05 07:12:48</lastBuildDate>
</channel>
<item>
<pubDate>Wed, 7 Dec 2005 18:02:15 GMT Standard Time</pubDate>

<title>Test</title>
<description>Das ist ein Test</description>
<link>http://localhost/011/index.php?module=News&id=cntnt01&cntnt01action=detail&cntnt01articleid=2
</item>
<item>
<pubDate>Sun, 13 Nov 2005 11:09:40 GMT Standard Time</pubDate>
<title>News Module Installed</title>
<description></description>
<link>http://localhost/011/index.php?module=News&id=cntnt01&cntnt01action=detail&cntnt01articleid=1

</item>
</RDF>
that script has a plavce in modules/News/backend.php.

Visitors can read the title and the description and can read  with the link the complete news item.
Didier LIROULET

Re: News module RSS feed do not work in 0.11 ?

Post by Didier LIROULET »

Hi Piratos.

Thanks a lot, with this template, all works fine  8)

Sorry for speaking french, i was answering that screenshots page of OCS Inventory NG new wen site is not made through a template, but by hand.

Kind regards and keep up the good work !
Piratos

Re: News module RSS feed do not work in 0.11 ?

Post by Piratos »

Here is my small backend.php to show news as a rdf - Feed.
place it in News

Code: Select all

<?php
include(dirname(dirname(dirname(__FILE__)))."/config.php");
include_once($config['root_path']."/lib/adodb/adodb.inc.php");

// Changes this to what you want
// Bitte Änderungen nach Wunsch durchführen
$titel="Backend zum Newsmodul CMSMadeSimple von piratos";
$language="de_de";
$copyright="Jan Czarnowski piratos@coftware.de";
$description='Dieses Dokument zeigt die Schlagzielen von Piratos';
$limit=30;
// End of you changes
// Ende deiner Anpassungen

$link=$config['root_url'].'/index.php';
$mod='?module=News&id=cntnt01&cntnt01action=detail&cntnt01articleid=';
$out="";
if (function_exists('mb_http_output')) {
	mb_http_output('pass');
}

$sql = "SELECT mn.*, mnc.news_category_name FROM ".$config['db_prefix']."module_news mn LEFT OUTER JOIN ".$config['db_prefix']."module_news_categories mnc ON mnc.news_category_id = mn.news_category_id WHERE status = 'published' ORDER by news_date DESC LIMIT 0,".$limit;
$db = &ADONewConnection($config['dbms'], 'cms:pear');
$db->Connect($config["db_hostname"],$config["db_username"],$config["db_password"],$config["db_name"]);
if (!$db) die("Connection failed");
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$row = $db->_Execute($sql);

if(!$row->EOF)
{
    header ('Content-Type:text/xml; charset=utf-8');
    $out .='<rdf:RDF>'."\n";
    $out .='<channel>'."\n";
    $out .='<title>'.$titel.'</title>'."\n";
    $out .='<link>'.$link.'</link>'."\n";
    $out .='<description>'.$description.'</description>'."\n";
    $out .='<language>'.$language.'</language>'."\n";
    $out .='<copyright>'.$copyright.'</copyright>'."\n";
    $out .='<lastBuildDate>'.date('d.m.y h:m:s').'</lastBuildDate>'."\n";
    $out .='</channel>'."\n";
    $i=0;
    while (!$row->EOF)
    {
        $i++;
        if ($i<$limit)
        {
        $out .='<item>'."\n";
        $out .='<pubDate>'.gmdate('D, j M Y H:i:s T', $db->UnixTimeStamp($row->fields['news_date'])).'</pubDate>'."\n";
        $out .='<title>'.$row->fields['news_title'].'</title>'."\n";
        $out .='<description>'.$row->fields['summary'].'</description>'."\n";
        $out .='<link>'.$link.$mod.$row->fields['news_id'].'</link>'."\n";
        $out .='</item>'."\n";
        }
        $row->MoveNext();
    }
       $out .='</rdf:RDF>'."\n";
}

$db->Close();

if (function_exists('mb_convert_encoding')) {
            echo mb_convert_encoding($out, 'UTF-8', 'auto');
}
else
{echo $out;}


?>
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: News module RSS feed do not work in 0.11 ?

Post by Ted »

Turns out that Firefox is expecting a different content type.  Calguy made some changes to the News module and it works fine without having to change the template.  They're in svn.
Alex_Leipzig

Re: News module RSS feed do not work in 0.11 ?

Post by Alex_Leipzig »

Hi Piratos,

thx for the great script. Is there any possibility of changing it, I need to add the actual content of the News item, and I don't want the link to show.
Thanks.

Btw, here's my modified script. (I needed rss2.0)

Code: Select all

<?php
include(dirname(dirname(dirname(__FILE__)))."/config.php");
include_once($config['root_path']."/lib/adodb/adodb.inc.php");

// Changes this to what you want
// Bitte Änderungen nach Wunsch durchführen
$titel="IALT aktuell";
$language="de";
$copyright="IALT - ialt@uni-leipzig.de";
$description='Akuelle Nachrichten vom IALT, Uni Leipzig';
$limit=30;
// End of your changes
// Ende deiner Anpassungen

$link=$config['root_url'].'/index.php';
$mod='?module=News&id=cntnt01&cntnt01action=detail&cntnt01articleid=';
$out="";
if (function_exists('mb_http_output')) {
mb_http_output('pass');
}

$sql = "SELECT mn.*, mnc.news_category_name FROM ".$config['db_prefix']."module_news mn LEFT OUTER JOIN ".$config['db_prefix']."module_news_categories mnc ON mnc.news_category_id = mn.news_category_id WHERE status = 'published' ORDER by news_date DESC LIMIT 0,".$limit;
$db = &ADONewConnection($config['dbms'], 'cms:pear');
$db->Connect($config["db_hostname"],$config["db_username"],$config["db_password"],$config["db_name"]);
if (!$db) die("Connection failed");
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$row = $db->_Execute($sql);

if(!$row->EOF)
{
    header ('Content-Type:text/xml; charset=iso-8859-1');
    $out .='<rss version="2.0">'."\n";
    $out .='<channel>'."\n";
    $out .='<title>'.$titel.'</title>'."\n";
    $out .='<link>'.$link.'</link>'."\n";
    $out .='<description>'.$description.'</description>'."\n";
    $out .='<language>'.$language.'</language>'."\n";
    $out .='<copyright>'.$copyright.'</copyright>'."\n";
    $i=0;
    while (!$row->EOF)
    {
        $i++;
        if ($i<$limit)
        {
        $out .='<item>'."\n";
        $out .='<pubDate>'.gmdate('D, j M Y H:i:s T', $db->UnixTimeStamp($row->fields['news_date'])).'</pubDate>'."\n";
        $out .='<title>'.$row->fields['news_title'].'</title>'."\n";
        $out .='<description>'.$row->fields['news_data'].'</description>'."\n";
        $out .='<guid isPermalink="true">'.$link.$mod.$row->fields['news_id'].'</guid>'."\n";
        $out .='</item>'."\n";
        }
        $row->MoveNext();
    }

    $out .='</channel>'."\n";
    $out .='</rss>'."\n";
}

$db->Close();

if (function_exists('mb_convert_encoding')) {
            echo mb_convert_encoding($out, 'iso-8859-1', 'auto');
}
else
{echo $out;}


?>
Last edited by Alex_Leipzig on Sun May 21, 2006 9:36 pm, edited 1 time in total.
Locked

Return to “CMSMS Core”