PDA

View Full Version : Pixelpost RSS-feed not showing links: possible solution


iphimeda
08-30-2006, 02:44 PM
I had the problem that my RSS feed wasn't showing any clickable links (as seen through Feedreader) and that - if I used html for the make up - there was no structure/make-up whatsoever in the text you give in in the 'image description/text' box.

Now I did the following (and that seems to solve the no clickable links and the disappeard html make-up problems)

In the index.php file I changed

$body = pullout($body);
$body = stripslashes($body);
$body = ereg_replace("\n","\n<br />",$body);
$body = strip_tags( $body );
$body = htmlspecialchars($body,ENT_QUOTES);

to
$body = pullout($body);
$body = ereg_replace("\n","\n<br />",$body);
$body = htmlspecialchars($body,ENT_QUOTES);

Is there any reason why I shouldn't do that and why those two statements/whatever they are called were included in the first place?

The two 'statements' I removed are:
$body = stripslashes($body);
$body = strip_tags( $body );

Connie
08-30-2006, 03:20 PM
this is an interesting approach and on fast hand I see 3 points:

1) you replaced some characters by ereg_replace, but stripslashes() could strip also slashes which you don't think of in the moment

2) strip_tags() is used to remove any HTML-tags (you want to keep the links)

3) did you validate your result with any feedvalidator?
did you check all possible combinations?

the RSS-format has strict rules, so we tried to keep as conform as possible, the result is that our feeds validate

if you want other things, why not?
there is always more than one way to happiness
but our aim is also to stay strictly validating and rules-compliant

iphimeda
08-30-2006, 03:58 PM
As for point 3, feedvalidator.org says it's a valid RSS feed (http://feedvalidator.org/check.cgi?url=http%3A//www.iphimeda.be/index.php%3Fx%3Drss)

GeoS
08-30-2006, 08:49 PM
It should be enough to change:
$body = stripslashes($body);
$body = strip_tags( $body );
to:
$body = stripslashes($body);
$body = strip_tags( $body, '<a>' );

iphimeda
08-30-2006, 09:22 PM
It would continue stripping the <br></br> and <p></p>, etc. tags, no?

Connie
08-31-2006, 05:43 AM
yes, the parameter "a" tells not to unstrip the anchor-tags but to strip all of the other tags

there is the chance to add more "allowed parameters" to this step

what will be stripped might depend on the PHP-version

Ariel
04-22-2007, 05:25 AM
This is an old thread, but is there a way to do this with PP 1.6 as well? It looks like index.php doesn't have those same lines anymore.

GeoS
04-22-2007, 11:40 PM
/includes/functions_feeds.php @ line 48

Ariel
04-23-2007, 07:30 AM
/includes/functions_feeds.php @ line 48

aha! Thank you GeoS!