July 13, 2016

Smarty - Display php variable on tpl file.



Hi every one after long time I come back on my blog,

Here some example to display PHP variable on Smarty template (.tpl) file:

1. Simple variable
{$variablename}

2. For count array
{count($arrayVariable)}

3. For if condition
{ if $variable==1}......{/if}

4. For foreach loop on template file
{ foreach $res as $key}
   {$key.id}
   {$key.name}
{/foreach}

Enjoy!

No comments:

Post a Comment

The Future of Technology: Emerging Trends to Watch in 2025

Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...