Thursday, 2 May 2013

Accessing PHP variable in .tpl

Greetings!

Sometimes situation may arise when you want some PHP code in tpl. Following piece of code will show how to achieve this.

{php}
    global $current_user;
    $this->_tpl_vars['current_user_email'] = $current_user->email1;
{/php}

Now use 'current_user_email' variable as follows in tpl.

<input type="text" id = "current_user_email" name="current_user_email" value='{$current_user_email}'>

Hope it helps.

Feel free to leave your comments.

No comments:

Post a Comment

Urdhva Tech Pvt. Ltd. Powered by Blogger.

Urdhva Tech

My photo
SugarCRM Consultants Contact us at contact@urdhva-tech.com Skype : urdhvatech

Search This Blog

Stay connected Socially

     

Total Pageviews

Popular Posts