You should assign all needed variables to Smarty from the PHP end. Don't use Ajax for this.
If $clientemail
is a fixed value in your script, the best way would be to keep a central configuration array with all values in a PHP file, including that file in every script instance (include "conf.php"
), and passing that array as a Smarty variable.
$conf = array();
$conf["clientemail"] = "[email protected]";
...........
$Smarty = new Smarty(); // or whichever way you do it
$Smarty->assign("conf", $conf);
............
Then in the template:
{$conf.clientemail}
If $clientemail
is a user-entered value, you could store it in $_SESSION
(if you have a session running) and fetch it:
In the PHP script that processes the form:
$_SESSION["clientemail"] = ..... wherever clientemail comes from
...........
$Smarty = new Smarty(); // or whichever way you do it
$Smarty->assign("clientemail", $_SESSION["clientemail"]);
............
Then in the template:
{$clientemail}
Note that this example will give you trouble if the user has two or more windows open and is filling out the same form at the same time: $_SESSION["clientemail"]
would be overwritten by each form submission.