|
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 |
devilmark84 Smarty n00b
Joined: 21 Feb 2008 Posts: 4
|
Posted: Thu Feb 21, 2008 10:49 am Post subject: Capitalize per caratteri italiani |
|
|
si presuppone che a questa funzione venga passata una stringa con entità html e questa restituisce la stringa capitalizzata con entità html.
Code: | function smarty_modifier_capitalize($string, $uc_digits = false)
{
smarty_modifier_capitalize_ucfirst(null, $uc_digits);
return htmlentities(preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', html_entity_decode($string,ENT_QUOTES)),ENT_QUOTES);
}
function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
{
static $_uc_digits = false;
if(isset($uc_digits)) {
$_uc_digits = $uc_digits;
return;
}
if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits)
return ucfirst($string[0]);
else
return $string[0];
}
|
Il testo restituito può essere inserito sia nel value di un input type (tra ""), sia nelle textarea.
Spero di avere fatto cosa gradita agli utilizzatori di smarty italiani. |
|
Back to top |
|
raoh980 Smarty Rookie
Joined: 13 May 2008 Posts: 7
|
Posted: Tue May 13, 2008 10:26 pm Post subject: |
|
|
Grazie ! |
|
Back to top |
|
flatfield Smarty Rookie
Joined: 30 Apr 2007 Posts: 18 Location: Genova (Italy)
|
Posted: Fri May 23, 2008 4:07 pm Post subject: |
|
|
Buono!!
Se puoi fai un esempio di utilizzo, con esempio di chiamata e l'output che produrrebbe |
|
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
|