Fork me on GitHub
Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules
New Posts New Topics All Posts All Forums Index General Modules Themes Development International XOOPS.org

Search

Learn XOOPS Core

Donat-O-Meter

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

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

- 2 2.5 2.6 3.0 4 6 2013 Abuse adslight Android AntiHarvesting AntiMalUser AntiSpam API Apple Battlefield billige Blocks Bootstrap Captcha cell cent chronolabs CHUNG Clicks content CĂN demo docek download Dresses evden eve facebook Fat floor Food for free Gateway Google Guide herre Honeypot HP Human HỘ IP iPhone jQuery Language List log Loss mobile module modules Monster new newbb news NHÀ online PARK phone PHP Prevention profile project Protector publisher Rapid RESIDENCE responsive review Rights rmcommon security Sentry site Smartphone Smoking Solution Spam Studio tag tags tdmcreate template The Theme themes web weight Wishcraft xoops Xortify

New Users

Registering user

# 137717

SLNK214324

Welcome to XOOPS!




Bottom   Previous Topic   Next Topic  Register To Post



#1 Posted on: 2008/4/1 5:28 Backend.php RSS hack for valid feeds
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?

Top

jayjay
Not too shy to talk
Not too shy to talk
Joined:
2003/9/10 7:32
Group:
Registered Users
Posts: 167
(Show More) (Show Less)


#2 Posted on: 2008/4/1 5:52 Re: Backend.php RSS hack for valid feeds
Entered into SourceForge Patches Tracker

Top


Please support XOOPS & DONATE
Use 2.5.7 | Debugging | Requests | Bugs
Mamba
Moderator
Moderator
Joined:
2004/4/23 13:58
From Ohio, USA
Group:
Webmaster
Registered Users
Designer Group
Posts: 8041
(Show More) (Show Less)


#3 Posted on: 2008/4/1 6:28 Re: Backend.php RSS hack for valid feeds
Thanks!

Top

jayjay
Not too shy to talk
Not too shy to talk
Joined:
2003/9/10 7:32
Group:
Registered Users
Posts: 167
(Show More) (Show Less)


#4 Posted on: 2008/4/1 7:14 Re: Backend.php RSS hack for valid feeds
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.

Top

jayjay
Not too shy to talk
Not too shy to talk
Joined:
2003/9/10 7:32
Group:
Registered Users
Posts: 167
(Show More) (Show Less)


#5 Posted on: 2008/5/14 22:43 Re: Backend.php RSS hack for valid feeds
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 !

Top


We are supporting XOOPS www.arabxoops.com
Mowaffaq
Moderator
Moderator
Joined:
2004/11/28 4:25
From Libya
Group:
Registered Users
Community Coordinator (temporary)
Posts: 1250
(Show More) (Show Less)


#6 Posted on: 2008/5/16 4:31 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 : 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.

Top


Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

* www.twitter.com/NegativityGear
* www.sourceforge.net/projects/chronolabs/
* www.facebook.com/epsacey
wishcraft
Module Developer
Module Developer
Joined:
2007/5/18 15:56
From Marrickville South, Sydney, Australia
Group:
Registered Users
Posts: 2120
(Show More) (Show Less)


#7 Posted on: 2008/5/16 5:20 Re: Backend.php RSS hack for valid feeds
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 ?



Top


We are supporting XOOPS www.arabxoops.com
Mowaffaq
Moderator
Moderator
Joined:
2004/11/28 4:25
From Libya
Group:
Registered Users
Community Coordinator (temporary)
Posts: 1250
(Show More) (Show Less)


#8 Posted on: 2008/5/16 7:06 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.

Top


Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

* www.twitter.com/NegativityGear
* www.sourceforge.net/projects/chronolabs/
* www.facebook.com/epsacey
wishcraft
Module Developer
Module Developer
Joined:
2007/5/18 15:56
From Marrickville South, Sydney, Australia
Group:
Registered Users
Posts: 2120
(Show More) (Show Less)


#9 Posted on: 2008/5/16 7:12 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.

Top


Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

* www.twitter.com/NegativityGear
* www.sourceforge.net/projects/chronolabs/
* www.facebook.com/epsacey
wishcraft
Module Developer
Module Developer
Joined:
2007/5/18 15:56
From Marrickville South, Sydney, Australia
Group:
Registered Users
Posts: 2120
(Show More) (Show Less)


#10 Posted on: 2008/5/16 9:58 Re: Backend.php RSS hack for valid feeds
Quote:
Don't Smoke Tobacco or anything else when programming.


Does else include creativity-boosting smoke too...

Top


Danordesign - Get XOOPS Modules!
XOOPS Nordic

Runeher
Module Developer
Module Developer
Joined:
2008/1/24 12:46
From Norway
Group:
Registered Users
Posts: 723
(Show More) (Show Less)







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.

[Advanced Search]