Kyaw Zin Wai
Kyaw Zin Wai

Reputation: 459

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.

Upvotes: 0

Views: 129

Answers (2)

Arkadiusz G.
Arkadiusz G.

Reputation: 1086

Try this:

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

Upvotes: 2

ZiTAL
ZiTAL

Reputation: 3581

years ago I used:

{php}
// php code
{/php}

Nowadays I don't know if it still works

Upvotes: 1

Related Questions