Jump to content
adixm

Error assign smarty variable

Recommended Posts

Hello

I tried to assign a new variable in php.
After upgrade to whmcs 8 $template->assign is not available anymore.
 

Quote

Error: Call to a member function assign() on null in

 

This is the code

$services = "Testtt";
$template->assign('vari', $services);

 

Thanks!

Share this post


Link to post
Share on other sites
21 hours ago, adixm said:

I tried to assign a new variable in php.

if you're creating PHP pages and wanting to add variables in them, then the creating pages docs explains that you could use...

$services = "Testtt";
$ca->assign('vari', $services);

if you're using a hook, then you can just return the variable.

... and if you're in the Smarty template, you can assign a variable directly without any changes to the Smarty Security Policy - the shorthand way to do that would be...

{assign vari "Testtt"} 

though there is a longer method as outline in the Smarty docs.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated