Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

New function to replace accents

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
cyril260
Smarty n00b


Joined: 10 May 2022
Posts: 1

PostPosted: Tue May 10, 2022 8:42 pm    Post subject: New function to replace accents Reply with quote

Hello,
this is my first smarty function in order to replace accents.


I have created a new file called "modifier.min.php" which is located in "smarty/plugin" folder

Below is the code that I have used:
Code:


function smarty_modifier_min($string)
    {
   $search  = array("ï","î","ç","â","à","é","è","ê","ô","û","Â","À","É","È","Ê","Ô","Û","Î","Ï","'","’");
   $replace = array("i","i","c","a","a","e","e","e","o","u","A","A","E","E","E","O","U","I","I"," "," ");
   $string= str_replace($search, $replace, $string);
   
   return $string;
     }



Then I have added to a template file the following code :

Code:
{$address['address1']|min}



And the accents are still there in the variable.


Could someone please tell me what did I do wrong ?

Thank you very much for your help

Best regards

Cyril
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP