Go Back   Pligg CMS Forum > Pligg Help > General Help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-21-2006, 03:55 AM
jackdaw's Avatar
Casual Pligger
 
Join Date: Apr 2006
Posts: 64
Thanks: 19
Thanked 4 Times in 3 Posts
RSS and localization

First thank you AshDigg, Yankidank & co for this great CMS. And beatniak for sharing the Mollio-Beat Template 1.0. With the beta 7 release and the mollio template, I've managed to get a Faroese languaged 'digg-clone' almost totally working, even if I'm very much a newbie. See http://www.sjey.com/

But I'm having trouble with especially the RSS feeds. Because of some special nordic characters like ð and ø and á, I've had to replace the UTF-8 charset/encoding strewn around in the Pligg source code with ISO-8859-1. And now it looks like it is working everywhere but in the RSS feeds (and maybe the 'friendly URL's).

I've tried replacing the UTF-8 in rss2.php with ISO-8859-1, and although it now looks better when looking at eg. the http://www.sjey.com/rss2.php?status=all xml-file, the nordic characters get replaced with '�' when added for example as Live Bookmarks in Firefox. That is my issue.

Also, as mentioned, all special characters get dropped in my friendly URLs. I guess that this is because of some similar issue as with the RSS feeds. And I understand that I maybe shouldn't have ð and ø and ý's in my URL. But could it be replaced with some substitute character (eg. ð -> d) ?

I'm SO close now, to have this site ready for launch. So please please help me :-)

(and by the way, in this forum it is REALLY hard to search for posts about RSS, as the word is too short to be used as a search word)
Reply With Quote
  #2 (permalink)  
Old 04-21-2006, 10:51 AM
jackdaw's Avatar
Casual Pligger
 
Join Date: Apr 2006
Posts: 64
Thanks: 19
Thanked 4 Times in 3 Posts
I just realized that when concerning category URLs, Pligg works fine with non-english characters.

OK, the URL for eg. my category 'Løgið' gets changed from http://www.sjey.com/index.php?category=Løgið to http://www.sjey.com/index.php?category=L%F8gi%F0 in the browser address bar. But that is a small price to pay, when they both still work, and I don't have to try to read a link like (if we were talking the friendly story URLs) "http://www.sjey.com/index.php?category=Lgi".

So, somebody with programming skills... how do I make the friendly URLs work in the same way as the category URLs?
Reply With Quote
  #3 (permalink)  
Old 04-23-2006, 05:17 AM
jackdaw's Avatar
Casual Pligger
 
Join Date: Apr 2006
Posts: 64
Thanks: 19
Thanked 4 Times in 3 Posts
Right, I think I solved it myself :)

Change line 119 in rss2.php from

Code:
echo '<?phpxml version="1.0" encoding="UTF-8"?'.'>' . "\n";
to

Code:
echo '<?xml version="1.0" encoding="UTF-8"?'.'>' . "\n";
Also, if you're having trouble with special characters, it might help to change the encoding from "UTF-8" to "ISO-8859-1". I use nordic characters like ð and æ and ý, and they look fine now in Firefox live bookmarks, Opera and Google Reader.

Last edited by jackdaw; 04-24-2006 at 05:00 AM..
Reply With Quote
  #4 (permalink)  
Old 04-28-2006, 01:40 AM
New Pligger
 
Join Date: Apr 2006
Location: Europe
Posts: 10
Thanks: 0
Thanked 4 Times in 2 Posts
Send a message via ICQ to jalso
special chars in friendly urls problem

hi,

(sorry, my english is very poor :( )

i had a several problem with special central european characters in a title. function makeUrlFriendly in utils.php removes non english characters, and when a word in a title contains only 1-2 "english" characters the friendly url looks like ugly :(

I write a second function undiacrtc() wich replaces special chars to regular. example:

á => a
etc..

i call this function before preg_replace in makeUrlFriendly() function.:


function makeUrlFriendly($input) {
// this function taken from http://us2.php.net/manual/en/functio...lace.php#54517
// then modified with the help of "j0zf" and "caomhin"
Global $db;

$input = undiacrtc(substr($input, 0, 240));

$output = preg_replace("/\b(an?d?|f?o(r|f)|the)\b/i" , "" , $input);

$output = trim($output);

// Replace spaces with underscores
$output = preg_replace("/\s/e" , "_" , $output);

// Remove non-word characters
$output = preg_replace("/\W/e" , "" , $output);

// $output = preg_replace( '/(_a_|_an_|_the_|_and_|_or_|_of_|_for_)/i', '_', $output );

$output = str_replace("_", "-", $output);
$output = str_replace("--", "-", $output);

$n = $db->get_var("SELECT count(*) FROM links WHERE link_title_url like '$output%'");
if ($n > 0)
{return $output . "-$n";}
else
{return $output;}


}

// my function is:


function undiacrtc( $text ) {
$replace=array(
'á' => 'a',
'Á' => 'A',
'é' => 'e',
'É' => 'E',
'í' => 'i',
'Í' => 'I',
'ó' => 'o',
'Ó' => 'O',
'ú' => 'u',
'Ú' => 'U',
'ü' => 'u',
'Ü' => 'U',
'ö' => 'o',
'Ö' => 'O',
'õ' => 'o',
'Õ' => 'O',
'û' => 'u',
'Û' => 'U',
'¾' => 'l',
'š' => 's',
'è' => 'c',
'?' => 't',
'ž' => 'z',
'ý' => 'y',
'ô' => 'o',
'ä' => 'a',
'ò' => 'n',
'å' => 'l',
'¼' => 'l',
'Š' => 's',
'È' => 'C',
'?' => 'T',
'Ž' => 'Z',
'Ý' => 'Y',
'Ò' => 'N',
'Å' => 'L',
'ì' => 'e',
'Ì' => 'E',
);

foreach ($replace as $key => $value) {
$text = ereg_replace($key, $value, $text );
}

return $text;
}


example title: starý článok

before my modification the url looks like:
story.php?title=star-lnok

after my modification:

story.php?title=stary-clanok
Reply With Quote
  #5 (permalink)  
Old 04-29-2006, 04:57 AM
jackdaw's Avatar
Casual Pligger
 
Join Date: Apr 2006
Posts: 64
Thanks: 19
Thanked 4 Times in 3 Posts
thank you jalso, that works great :)
Reply With Quote
  #6 (permalink)  
Old 05-10-2007, 04:24 AM
New Pligger
 
Join Date: Apr 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Jalso, could you explain a little more your method, or put your utils.php file for download, because I try it but it does not work : either I get an error or it does not change anything in the urls.
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Search Engine Friendly URLs by vBSEO 3.2.0