yes Pascal, my idea from slug behavior of Doctrine. but i think about a helper, but your idea is great to.
Salome, thanks for your idea. http://snippets.symfony-project.org/snippet/366 On Fri, Oct 16, 2009 at 10:59 AM, [MA]Pascal <[email protected]> wrote: > > Hi, > > or you can use Doctrine_Inflector::urlize(); > > I don't think its place should be in helpers > > Cheers > [MA]Pascal > > On Oct 16, 1:46 pm, Alexandre SALOME <[email protected]> > wrote: > > Post is as a snippet :http://snippets.symfony-project.org/ > > > > I think one day I will be happy to find back your function :) > > > > 2009/10/16 Raphael <[email protected]> > > > > > > > > > Its simple and util. > > > > > I have a code: > > > > > function slugString($string, $replacement = '_') > > > { > > > $aux = preg_quote($replacement, '/'); > > > > > $map = array( > > > '/à|á|ã|â/' => 'a', > > > '/è|é|ê|ẽ|ë/' => 'e', > > > '/ì|í|î/' => 'i', > > > '/ò|ó|ô|ø/' => 'o', > > > '/ù|ú|ũ|û/' => 'u', > > > '/ç/' => 'c', > > > '/ñ/' => 'n', > > > '/ä|æ/' => 'ae', > > > '/ö/' => 'oe', > > > '/ü/' => 'ue', > > > '/Ä/' => 'Ae', > > > '/Ü/' => 'Ue', > > > '/Ö/' => 'Oe', > > > '/ß/' => 'ss', > > > '/[^\w\s]/' => ' ', > > > '/\\s+/' => $replacement > > > ); > > > > > return preg_replace(array_keys($map), array_values($map), $string); > > > } > > > > > -- > > > Raphael Almeida Araújo > > > Homepage:http://sites.google.com/site/raphoxaraujo > > > > -- > > Alexandre Salomé -- [email protected] > > > -- Raphael Almeida Araújo Homepage: http://sites.google.com/site/raphoxaraujo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---
