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

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...