urlize modifier


This Smarty modifier transforms a string so that it can be used in a URL. It uses the urlize() method of the \Temma\Utils\Text object.


Here is an example:

    {foreach $articles as $article}
            <a href="/article/voir/{$article.id}/{$article.title|urlize}">
  • Lines 2 à 8 : A loop goes through all the items stored in the $articles list.
  • Line 4 : A link to each article is created. The URL contains the article identifier and its title after "URLification".
  • Line 5 : The title of each article is displayed as a link.


{'Hello world'|urlize} {* 'hello-world' *}
{'àéïöùÿ'|urlize} {* 'aeiouy' *}
{'Questions?? Answers!!'|urlize} {* 'questions-answers' *}