Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

|utf8: a replacement over |htmlentities

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Mon Feb 27, 2012 9:08 pm    Post subject: |utf8: a replacement over |htmlentities Reply with quote

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
View user's profile Send private message Visit poster's website
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Mon Feb 27, 2012 9:30 pm    Post subject: Reply with quote

1) what exactly is the benefit of serving utf8 as entities?
2) whatever happened to {$foo|escape:"htmlall"}?
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    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