|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Mon Feb 27, 2012 9:08 pm Post subject: |utf8: a replacement over |htmlentities |
|
|
If you are looking for shorter replacement for |htmlentities, the below plugin might be helpful to use.
File: modifier.utf8.php
Code: |
<?php
/**
* UTF-8 safe HTML Entities
*/
function smarty_modifier_utf8($utf8_string='')
{
# ENT_IGNORE is not available on old systems.
return htmlentities($utf8_string, ENT_QUOTES, "UTF-8");
}
?> |
Usage:
Code: | <input type="text" name="cms[page_title]" value="{$cms.page_title|utf8}" class="input" id="cms-page_title" /> |
It is safe to use as value="" as well. For example in the pages where you want to EDIT some records from the database. |
|
Back to top |
|
rodneyrehm Administrator
Joined: 30 Mar 2007 Posts: 674 Location: Germany, border to Switzerland
|
Posted: Mon Feb 27, 2012 9:30 pm Post subject: |
|
|
1) what exactly is the benefit of serving utf8 as entities?
2) whatever happened to {$foo|escape:"htmlall"}? _________________ Twitter |
|
Back to top |
|
|
|
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
|