PDA

View Full Version : [preg_replace] Problème de conversion caractères spéciaux


ethan2029
08-15-2007, 06:43 PM
Bonjour à tous,

J'ai ajouté une nouvelle fonction dans le répertoire libs/smarty/plugins/
pour pouvoir retirer les espaces et caractères spéciaux dans une URL...

Ca marche bien pour tous les espaces blancs (remplacé par un UNDERSCORE) mais pas pour les caractères spéciaux.

Par exemple : au lieu d'avoir "société de struture.html"
J'aimerais avoir "societe_de_struture.html"

function smarty_modifier_filter($string){
$search = array ('@[éèêëÊË]@i', '@[ ]@',);
$replace = array ('e', '_');
return preg_replace($search, $replace, $string);}

Est-ce que vous voyez une erreur dans ma fonction ??

Merci d'avance !

Boby
08-16-2007, 07:00 PM
Sorry for not replying in france, but I guess you're looking for:

Content visible to registered users only.This is part of a new function coming in the next phpLD release to correct friendly URLs ;)

Hope it helps.
Boby

ethan2029
08-16-2007, 07:12 PM
Thanx Boby for your help, but I don't no why it doesn't work...
Your fonction is pretty good but I always have my "é" in my URL...

It looks like my function... Everything working, except special é, à, è... (the most important ;))

Content visible to registered users only.So i'm still looking for a solution !!

Thanx again for your time.

Ethan

Content visible to registered users only.

Boby
08-16-2007, 11:23 PM
Can I ask how you call this function, or how you use it?

dcaceres
08-16-2007, 11:54 PM
I'm interested in this Mod... Where I can add it?