|
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 |
ciri Smarty Rookie
Joined: 12 Dec 2007 Posts: 7
|
Posted: Thu Dec 27, 2007 1:22 pm Post subject: La funzione insert |
|
|
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 |
|
flatfield Smarty Rookie
Joined: 30 Apr 2007 Posts: 18 Location: Genova (Italy)
|
Posted: Fri Dec 28, 2007 8:48 am Post subject: |
|
|
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 |
|
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
|