简体   繁体   中英

Smarty variable in controller to a tpl

I created a smarty variable to a controller ( OrderController.php ). The customer select a value and his choice is in this variable. This work perfectly.

Now, I want to use this variable (value) in my back office ( tpl file) to display the value. How can I do this ?

In ordercontroller.php

$smarty->assign("myvar", $myvar); // this assigns the variable to smarty.

Now in your tpl file that you want to display this variable use the syntax.

{$myvar} and it will display the contents of your variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM