Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

My Cent

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Italian
View previous topic :: View next topic  
Author Message
XarFace
Smarty n00b


Joined: 28 Mar 2006
Posts: 4

PostPosted: Sun Sep 03, 2006 6:03 pm    Post subject: My Cent Reply with quote

Giusto per provare a ravvivare un filino l'ambiente, posto un mio hack al modificatore "upper"

Code:

<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty upper modifier plugin
 *
 * Type:     modifier<br>
 * Name:     upper<br>
 * Purpose:  convert string to uppercase
 * @link http://smarty.php.net/manual/en/language.modifier.upper.php
 *          upper (Smarty online manual)
 * @param string
 * @return string
 */
function smarty_modifier_upper($string)
   {
   $string=strtr($string, "àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞß");
   return strtoupper($string);
   }

?>


e provo a spiegarlo:
il modificatore "upper" converte in maiuscolo una data stringa.
Purtroppo, non funziona con un set esteso di caratteri (per intenderci, le lettere accentate restano minuscole)

Questa riscrittura del modificatore rende maiuscoli anche i caratteri speciali.

Ovviamente, si può estendere la modalità anche ad altri modificatori simili: lower, capitalize, etc

Sperando di aver fatto cosa gradita e utile
Back to top
View user's profile Send private message
TNTforum
Smarty Rookie


Joined: 30 Oct 2006
Posts: 5

PostPosted: Mon Oct 30, 2006 5:34 pm    Post subject: Reply with quote

Solo che forse sarebbe meglio tradurre le lettere accentate in entità HTML.
Back to top
View user's profile Send private message Visit poster's website
XarFace
Smarty n00b


Joined: 28 Mar 2006
Posts: 4

PostPosted: Thu Nov 02, 2006 8:41 pm    Post subject: Reply with quote

TNTforum wrote:
Solo che forse sarebbe meglio tradurre le lettere accentate in entità HTML.


mica vero: la codifica del set di caratteri si può gestire diversamente (usando un set unicode, per esempio)
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Italian 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