overbags Posted May 14, 2021 Share Posted May 14, 2021 (edited) ciao a tutti sto cercando di modificare una pagina tpl e devo inserire in un div un testo composto da più variabili php il problema è che non riesco a fare il concatenamento vi posto un esempio di come farei in un file php per farvi capire ma che in tpl non funziona {$nome_cognome = $firstname . " " . $lastname} <div> {$nome_cognome} </div> ho necessità che risulti in un'unica variabile ... so che potrei fare {$firstname} {$lastname} Edited May 14, 2021 by overbags (see edit history) Link to comment Share on other sites More sharing options...
fedesib Posted May 17, 2021 Share Posted May 17, 2021 Ciao, dai un'occhiata a questi threads, credo che ti possano aiutare: https://stackoverflow.com/questions/11144406/smarty-local-variable-concatenation-with-string/11144453 https://stackoverflow.com/questions/44278960/concatenate-a-variable-and-a-string-in-smarty-in-order-to-include-a-file Buona giornata, Federica Link to comment Share on other sites More sharing options...
overbags Posted May 17, 2021 Author Share Posted May 17, 2021 soluzione It is always recommended that variables of this kind be generated in the controller. To generate them in the .tpl you can try like this {assign var='nome_cognome' value="{$firstname}{' '}{$lastname}"} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now