1
jayjay
Backend.php RSS hack for valid feeds
  • 2008/4/1 10:28

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


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?

2
Mamba
Re: Backend.php RSS hack for valid feeds
  • 2008/4/1 10:52

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Entered into SourceForge Patches Tracker
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
jayjay
Re: Backend.php RSS hack for valid feeds
  • 2008/4/1 11:28

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Thanks!

4
jayjay
Re: Backend.php RSS hack for valid feeds
  • 2008/4/1 12:14

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


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.

5
Anonymous
Re: Backend.php RSS hack for valid feeds
  • 2008/5/15 3:43

  • Anonymous

  • Posts: 0

  • Since:


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 !

6
wishcraft
Re: Backend.php RSS hack for valid feeds

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 : https://xoops.org/modules/newbb/viewtopic.php?topic_id=62187&forum=10&post_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.
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

7
Anonymous
Re: Backend.php RSS hack for valid feeds
  • 2008/5/16 10:20

  • Anonymous

  • Posts: 0

  • Since:


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:



For a Sitemap index file, the header can look like this:


xmlns="http://www.sitemaps.org/schemas/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:
//
//     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 
"1.0" encoding="$charset"?>n";
print 
"2.0">";
print 
"n";
print 
"</span><span style="color: #0000BB">$channel_title</span><span style="color: #DD0000">n";
print 
"$channel_linkn";
print 
"$channel_desc";
print 
"$channel_languagen";
print 
"$channel_lastbuildn";
print 
"$channel_generatorn";
    
$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 
"tn";
    print 
"tt </span><span style="color: #0000BB">$title</span><span style="color: #DD0000"> n";
    print 
"tt$galpath/displayimage.php?pid=$pidn";
    print 
"tt$channel_editorn";
        print 
"tt$channel_lastbuildn";
        print 
"tt";
        echo  
htmlspecialchars("

$albumpath$filepath" . "thumb_$filename" alt="" /> 

$keywords

"
);
        print 
"n";
    print 
"tn";
    print 
"n";
}
print 
"";
print 
"";


to:

//
//     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 
"1.0" encoding="$charset"?>n";
print 
"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 
"tn";
    print 
"tt$galpath/displayimage.php?pid=$pidn";
    print 
"ttmonthlyn";
    print 
"tt0.5n";
    print 
"tn";
    print 
"n";
}
print 
"";


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 ?


8
wishcraft
Re: Backend.php RSS hack for valid feeds

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.
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

9
wishcraft
Re: Backend.php RSS hack for valid feeds

Quote:

Patches Tracker


Do my nicatbate QC quit smoking Patches have a tracker... With nanoscience anything could.
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

10
Runeher
Re: Backend.php RSS hack for valid feeds
  • 2008/5/16 14:58

  • Runeher

  • Module Developer

  • Posts: 825

  • Since: 2008/1/24


Quote:
Don't Smoke Tobacco or anything else when programming.


Does else include creativity-boosting smoke too...

Login

Who's Online

324 user(s) are online (222 user(s) are browsing Support Forums)


Members: 0


Guests: 324


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits