jayjay jayjay
  • Not too shy to talk
  • Not too shy to talk
  • Joined: 2003/9/10 8:32
  • Group: Registered Users
  • Posts: 175
  • Posted on: 2008/4/1 6:28
Backend.php RSS hack for valid feeds #1
I added this code to the template "system_rss.html" to make RSS feeds 100% compatible with all aggregators:

Line 2 - after xml version:
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">


Line 14 - after channel language:
<atom:link href="<{$xoops_url}><{$smarty.server.REQUEST_URI}>" rel="self" type="application/rss+xml" />


I use the above smarty code because hardcoding the self-address of your rss feed (eg. "http://mydomain.org/backend.php") will break your feed in other modules that use backend.php to generate RSS feeds (namely wf-downloads).

Can these changes be added to a following release?
Mamba Mamba
  • Moderator
  • Moderator
  • Joined: 2004/4/23 14:58
  • From Ohio, USA
  • Group: Webmaster Registered Users Designer Group Super Moderator
  • Posts: 10293
  • Posted on: 2008/4/1 6:52
Re: Backend.php RSS hack for valid feeds #2
Entered into SourceForge Patches Tracker
Please support XOOPS & DONATE
Use 2.5.8 | Debug | Requests | Bugs
jayjay jayjay
  • Not too shy to talk
  • Not too shy to talk
  • Joined: 2003/9/10 8:32
  • Group: Registered Users
  • Posts: 175
  • Posted on: 2008/4/1 7:28
Re: Backend.php RSS hack for valid feeds #3
Thanks!
jayjay jayjay
  • Not too shy to talk
  • Not too shy to talk
  • Joined: 2003/9/10 8:32
  • Group: Registered Users
  • Posts: 175
  • Posted on: 2008/4/1 8:14
Re: Backend.php RSS hack for valid feeds #4
Quote:

jayjay wrote:

Line 14 - after channel language:
<atom:link href="<{$xoops_url}><{$smarty.server.REQUEST_URI}>" rel="self" type="application/rss+xml" />



I haven't tested this, but I think you can also use <{$xoops_requesturi}> instead of <{$smarty.server.REQUEST_URI}>. I think this has the same result.
Anonymous  
Re: Backend.php RSS hack for valid feeds #5
Google Webmaster Center mark all my RSS feed ( backend.php, newbb/rss.php, mylinks.rss.php, .. etc ) as invalid RSS feeds becaue it is not contain:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">


So now I convert all ROR feeds in my site to google xml sitemap !
wishcraft wishcraft
  • Module Developer
  • Module Developer
  • Joined: 2007/5/18 16:56
  • From Marrickville South, NSW, Australia
  • Group: Registered Users
  • Posts: 3652
  • Posted on: 2008/5/16 5:31
Re: Backend.php RSS hack for valid feeds #6
Well I have been building a separate system for sitemaps. It isn't very simple if you are not a programmer, I made a basic instruction manual for sitemaps..

In this forum post : http://www.xoops.org/modules/newbb/vi ... id=280669#forumpost280669

I want to add a sitemap system for modules so it is more autonomously generated. But it involves modifying the database.. And then you have a changed structure of the database...

grr.. so many users, so many &*(^*& up if we change the database at this stage.. with over 6 million downloads, that is an end userbase of 6000000 x (2^10) + thats alot of potential sites to go down.
Anonymous  
Re: Backend.php RSS hack for valid feeds #7
Hi wishcraft,

Befor 1 year ago, I made RSS feed hack for xcgal Module and I added this RSS link to Google Webmaster Center, it is accepted and everything is ok.

Resized Image

But before few days, I saw ERRORS alert beside xcgal RSS link and all other RSS Feeds and the error type was Unsupported file format, and at google help they are say:

Quote:
Your Sitemap does not appear to be in a supported format. Please ensure it meets our Sitemap guidelines and resubmit.

Some things you might check are:

That the file uses the correct header. For a Sitemap file, the header can look like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
For a Sitemap index file, the header can look like this:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex
xmlns="http://www.sitemaps.org/schemas<wbr>/sitemap/0.9">
That the namespace in the header is "http://www.sitemaps.org/schemas/sitemap/0.9". Note that this must end in 0.9. If it ends in .9, you'll see an error.

That each XML attribute is enclosed in either single quotes (') or double quotes (") and that those quotes are straight, not curly. If you use a word processing program, such as Microsoft Word, you may find that it inserts curly quotes.


So, what I do is converting my xcgal RSS from:
<?php
//
//     XOOPS Gallery RSS 2.0 
//    displays latest photos via RSS 2.0 feed.
//  Copyright (c) 2007 Mowaffak Ali - www.arabxoops.com
//  Thanks to www.mypapit.net                 
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//    
//

include_once '../../mainfile.php';

define('IN_XCGALLERY'true);
require(
'include/init.inc.php');

$charset='windows-1256';
$sitename htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
$email checkEmail($xoopsConfig['adminmail'],false);
$slogan htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES);
$module $xoopsModule->getVar('name');
$channel_link XOOPS_URL.'/';
$channel_desc xoops_utf8_encode($slogan);
$channel_lastbuild formatTimestamp(time(), 'rss');
$channel_editor xoops_utf8_encode($email);
$channel_category xoops_utf8_encode($category);
$channel_generator xoops_utf8_encode($module);
$channel_language _LANGCODE;

$galpath =  XOOPS_URL.'/modules/xcgal';
$albumpath $galpath.'/albums/';

// How many items you want to show in RSS feed
$upperlimit 10

header('Content-Type:text/xml; charset='.$charset);
$title $sitename.' - '.$module;
$channel_title xoops_utf8_encode($title);
print 
"<?xml version="1.0" encoding="$charset"?>n";
print 
"<rss version="2.0">";
print 
"<channel>n";
print 
"<title>$channel_title</title>n";
print 
"<link>$channel_link</link>n";
print 
"<description>$channel_desc</description>";
print 
"<language>$channel_language</language>n";
print 
"<lastBuildDate>$channel_lastbuild</lastBuildDate>n";
print 
"<generator>$channel_generator</generator>n";
    
$result=$xoopsDB->query("SELECT pid,ctime,title,keywords,filepath,filename FROM ".$xoopsDB->prefix("xcgal_pictures")." ORDER BY pid DESC LIMIT 0,$upperlimit");
while (list(
$pid$ctime$title$keywords,$filepath,$filename) = mysql_fetch_row($result)) {
    print 
"t<item>n";
    print 
"tt<title> $title </title>n";
    print 
"tt<link>$galpath/displayimage.php?pid=$pid</link>n";
    print 
"tt<author>$channel_editor</author>n";
        print 
"tt<pubDate>$channel_lastbuild</pubDate>n";
        print 
"tt<description>";
        echo  
htmlspecialchars("<p><img src="$albumpath$filepath" . "thumb_$filename" alt="" /> </p><p>$keywords</p>");
        print 
"</description>n";
    print 
"t</item>n";
    print 
"n";
}
print 
"</channel>";
print 
"</rss>";


to:

<?php
//
//     XOOPS Gallery RSS 2.0 
//    displays latest photo via RSS 2.0 feed.
//      Copyright (c) 2007 Mowaffak Ali                  
//      http://www.arabxoops.com/ 
//                    
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//
//  
//    Thanks to http://mypapit.net/pproject
//

include_once '../../mainfile.php';

define('IN_XCGALLERY'true);
require(
'include/init.inc.php');

$charset='UTF-8';
$sitename htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
$module $xoopsModule->getVar('name');
$channel_link XOOPS_URL.'/';
$channel_lastbuild formatTimestamp(time(), 'rss');
$channel_language _LANGCODE;

$galpath =  XOOPS_URL.'/modules/xcgal';
$albumpath $galpath.'/albums/';

// How many items you want to show in RSS feed
$upperlimit 100

header('Content-Type:text/xml; charset='.$charset);
$title $sitename.' - '.$module;
$channel_title xoops_utf8_encode($title);
print 
"<?xml version="1.0" encoding="$charset"?>n";
print 
"<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">n";
    
$result=$xoopsDB->query("SELECT pid FROM ".$xoopsDB->prefix("xcgal_pictures")." ORDER BY pid DESC LIMIT 0,$upperlimit");
while (list(
$pid) = mysql_fetch_row($result)) {
    print 
"t<url>n";
    print 
"tt<loc>$galpath/displayimage.php?pid=$pid</loc>n";
    print 
"tt<changefreq>monthly</changefreq>n";
    print 
"tt<priority>0.5</priority>n";
    print 
"t</url>n";
    print 
"n";
}
print 
"</urlset>";


and now the error fixed!

I know windows-1256 is not valid charset for RSS but I use it because my site don't support UTF-8.

Am I right ? because I'm looking for convert all RSS feeds in my site to this sitemap structure.

Any comments ?

wishcraft wishcraft
  • Module Developer
  • Module Developer
  • Joined: 2007/5/18 16:56
  • From Marrickville South, NSW, Australia
  • Group: Registered Users
  • Posts: 3652
  • Posted on: 2008/5/16 8:06
Re: Backend.php RSS hack for valid feeds #8
Looks like your regular expressions are not right.. \t for tab \n for new line.

Thanks,

Please I am here to develop XOOPS the core...

other hints: Don't Smoke Tobacco or anything else when programming.
wishcraft wishcraft
  • Module Developer
  • Module Developer
  • Joined: 2007/5/18 16:56
  • From Marrickville South, NSW, Australia
  • Group: Registered Users
  • Posts: 3652
  • Posted on: 2008/5/16 8:12
Re: Backend.php RSS hack for valid feeds #9
Quote:

Patches Tracker


Do my nicatbate QC quit smoking Patches have a tracker... With nanoscience anything could.
Runeher Runeher
  • Module Developer
  • Module Developer
  • Joined: 2008/1/24 13:46
  • From Norway
  • Group: Registered Users
  • Posts: 819
  • Posted on: 2008/5/16 10:58
Re: Backend.php RSS hack for valid feeds #10
Quote:
Don't Smoke Tobacco or anything else when programming.


Does else include creativity-boosting smoke too...
How to effectively post a question in the Xoops forums? - Read here...
Design by: XOOPS UI/UX Team