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

La funzione insert

 
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
ciri
Smarty Rookie


Joined: 12 Dec 2007
Posts: 7

PostPosted: Thu Dec 27, 2007 1:22 pm    Post subject: La funzione insert Reply with quote

Salve!

All'interno del mio template ho:
Code:
{insert name="getNumero"}

dove la funzione getNumero mi restituisce un numero casuale.

Tale template mi rappresenta un form.
Come faccio a passare tale valore dal form allo script?

Mi spiego! Io ho nel file form.tpl:


Code:

<form action="file.php" method="post">
...
<label>Protezione SPAM (Quanto fa {insert name="getNumero"} + {insert name="getNumero"}?)</label>
<input name="spam" id="spam" value="Scrivi qui il risultato..." type="text" />
...
</form>


Come faccio ad ottenere i valori restituiti dalle funzioni getNumero all'interno del mio file.php?

Qualche idea?
Back to top
View user's profile Send private message
flatfield
Smarty Rookie


Joined: 30 Apr 2007
Posts: 18
Location: Genova (Italy)

PostPosted: Fri Dec 28, 2007 8:48 am    Post subject: Reply with quote

Quote:

{insert name="getNumero"}
Come faccio ad ottenere i valori restituiti dalle funzioni getNumero all'interno del mio file.php?


Ma la insert dentro al tpl, va già a cercare una funzione in php, quindi te dovresti già averlo tale valore in php....
Probabilmente ti basta semplicemente rendere visibile una certa variabile della funzione php "getNumero" dentro al flusso php (rendendola globale, richiamandola anche dal codice php e facendoti restituire il valore voluto ecc. ecc.).
Mi sembra però più un problema di php che di Smarty Very Happy
Back to top
View user's profile Send private message Visit poster's website
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