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

variabili vuote

 
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
jeeve
Smarty n00b


Joined: 27 Jan 2009
Posts: 2

PostPosted: Tue Jan 27, 2009 9:18 am    Post subject: variabili vuote Reply with quote

ecco il mio problema:

Attualmente ho una pagina php che prende i dati dal db e me li mostra tramite un file .tpl nel seguente modo:

scarpe: 2 televisioni: 3 radio: 4
sandali: 4 penne: 4 scatole: 4
mouse: 5 tastiere: 6 batterie: 8

sia scarpe ecc che il numero sono variabili, nel senso che a seconda del linguaggio selezionato la variabile scape puo diventare shoes ecc

il file tpl e' fatto in modo da generare una tabella a tre colonne con all'interno i valori di cui sopra, ora se per caso il valore di penne e' pari a zero mi appare cosi:

scarpe: 2 televisioni: 3 radio: 4
sandali: 4 penne: scatole: 4
mouse: 5 tastiere: 6 batterie: 8

io vorrei fare sparire anche la scritta penne, per cui ho messo un ciclo if e quindi non passo la variabile $penne_italiano e mi appare cosi:

scarpe: 2 televisioni: 3 radio: 4
sandali: 4 scatole: 4
mouse: 5 tastiere: 6 batterie: 8

visto che il file tpl e' impostato per creare una tabella a 3 colonne mentre io vorrei apparisse cosi:

scarpe: 2 televisioni: 3 radio: 4
sandali: 4 scatole: 4 mouse: 5
tastiere: 6 batterie: 8

Domanda utilizzando smarty posso ottenere questo risultato e se si come?
Back to top
View user's profile Send private message
antoniog
Smarty Rookie


Joined: 01 Dec 2011
Posts: 12

PostPosted: Thu Dec 01, 2011 7:33 pm    Post subject: Reply with quote

In PHP so che si può usare unset() per eliminare dall'array uno o più dati che non si intende utilizzare.
Vedi il manuale di PHP.
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