News:

Join the Facebook Fan Page.

Main Menu

SMF & RSS problem

Started by Angelotus, July 23, 2008, 04:10:04 AM

Previous topic - Next topic

Angelotus

Hi,

I use smf 2.0 and have search engine friendly urls enabled.

I use this script to fetch feed from the boards for another site of mine (www.klifix.eu).

The feed is fetched correctly only the link to the original post is not correct. It is always:
http://forum.weeklyfun.nl/index.php/$1.html$2

I have tried it with other scripts as well and still the same link appears.

What is the problem and how to solve this???

Rumbaar

If you turn off search engine friendly URLs does it change the output?

How does the 'bridge' php file extract the RSS feed?  Can it handle the type of RSS feed and links SMF outputs?
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Angelotus

If SEF turned of the links are correct, but turned on not.

Rumbaar

Well you've got a choice then :)  Either turn off SEF (which when on doesn't really help Search Engines anyways) or fix the script you are using.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Angelotus

I found out it doesn't have to do anything with the script I am using, but with a bug in SMF.
http://dev.simplemachines.org/mantis/view.php?id=1790

Rumbaar

Ha, nice. That'll learn me not to search, but the bugtracker has always been hard for me search :)  You might still have to turn off SEF until the public next release.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Angelotus

Thanks, done that! It works fine now, so I keep it this way untill next release..

Rumbaar

If I knew the fix I'd post it here and the SVN has always been in the too hard basket for me to look at or learn :)  Hopefully the next release will be soon.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

I

Quote from: Rumbaar on July 25, 2008, 03:55:06 AM
If I knew the fix I'd post it here and the SVN has always been in the too hard basket for me to look at or learn :)  Hopefully the next release will be soon.

I did NOT want to wait for beta 4 when it should be fixed...
AND I did NOT want to turn off search engine friendly urls...
So here is what I did...

WARNING, try this at your own risk!

Since this is only a problem with my RSS news feeds, I took a look at:

Sources/News.php

function fix_possible_url
(Line 355) I found this...

$val = preg_replace('/^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+)(#[^"]*)?$/e', '\'\' . \$scripturl . \'/\' . strtr(\'\$1\', \'&;=\', \'//,\') . \'.html\$2\'', $val);



I compared this with the same code from the SMF 1-1-4 load (line 330):

$val = preg_replace('/^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+)(#[^"]*)?$/e', "'' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2'", $val);


The main difference is the 1-1-4 code uses double quotes which allows $1 and $2 to be considered as variables instead of literals.  Hence $1.html$2 is replaced with the content of $1 and $2

I replaced the one line in the 2.0b3 code with the one line from the 1-1-4 code and it works!

USE AT YOUR OWN RISK!
~ ~ ~ LAN ~ ~ ~
My Grandkids call me "Lolo"
My Family calls me "LAN"
I like to think of me as "I"
I am a simple man!

Angelotus

I'll try that out! Thanks for sharing your thoughts with us!

I

Quote from: Angelotus on August 01, 2008, 02:36:01 AM
I'll try that out! Thanks for sharing your thoughts with us!
No problem!  This works fine with my site, but I am not using your ticker.  If you have any problems, let me know cause I have a site coming up and I am thinking of using the ticker you are using to promote the SMF links - looks interesting!
~ ~ ~ LAN ~ ~ ~
My Grandkids call me "Lolo"
My Family calls me "LAN"
I like to think of me as "I"
I am a simple man!

metallica48423

the fix that was done between revisions 7041 and 7042 to fix this error is as follows

Code (Find in /Sources/News.php) Select
$val = preg_replace('/^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+)(#[^"]*)?$/e', '\'\' . \$scripturl . \'/\' . strtr(\'\$1\', \'&;=\', \'//,\') . \'.html\$2\'', $val);

Code (Replace with) Select
$val = preg_replace('/^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+)(#[^"]*)?$/e', '\'\' . $scripturl . \'/\' . strtr(\'$1\', \'&;=\', \'//,\') . \'.html$2\'', $val);

And...

Code (Find in /Sources/Themes.php) Select
$old_template = preg_replace('~\<\?php(.*)\?\>~es', 'phpcodefix(\'\$1\')', $old_template);

Code (Replace With) Select
$old_template = preg_replace('~\<\?php(.*)\?\>~es', 'phpcodefix(\'$1\')', $old_template);
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

I

Thanks metallica,

I made the changes and it works great!  Solved another problem I was working!

Again, thanks!
~ ~ ~ LAN ~ ~ ~
My Grandkids call me "Lolo"
My Family calls me "LAN"
I like to think of me as "I"
I am a simple man!

metallica48423

Good to hear :)

Angelotus: any luck?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Angelotus

Have had no time to try it out yet, but will do it further this week and will tell if it worked :)

metallica48423

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Angelotus

Well, I made the fixes, turned on SEF and it works perfect now! Metallica and others, thanks for helping me out with this!
It didn't had anything to do with the DDscript by the way :)

metallica48423

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

I

Quote from: Angelotus on August 03, 2008, 10:11:26 AM
Well, I made the fixes, turned on SEF and it works perfect now! Metallica and others, thanks for helping me out with this!
It didn't had anything to do with the DDscript by the way :)

Yes, thanks again to Metallica for posting this fix.

Angelotus:  Thanks for the info on the DDscript [nofollow] - my wife really likes this script and we are adding it to my High School Alumni Association page!  This will allow the Class sites (some sub-domains and others with their own domains) to incorporate their latest news from our SMF pages on their sites also!

Of course anything my wife likes, I like!  It is always a pleasant surprise to be working on a problem and come up with something new that actually works - thanks!
~ ~ ~ LAN ~ ~ ~
My Grandkids call me "Lolo"
My Family calls me "LAN"
I like to think of me as "I"
I am a simple man!

Angelotus

Your Welcome! There can be found a lot of interesting scripts on Dynamic Drive!

Advertisement: