简体   繁体   中英

How to write PHP Syntax in Smarty?

I want to know how to write php syntax in smarty template(.tpl).

For example I'm using below php syntax in Pure Codeigniter(No Smarty include) and it's working perfectly.

<?= isset($value) ? $value['phone'] : '' ?>

But in Smarty, It's not work. How should write this? Please suggest me.

Try this:

{if isset($value)}
    $value['phone']
{/if}

years ago I used:

{php}
// php code
{/php}

Nowadays I don't know if it still works

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