Jump to content

Get smarty variable in PHP


Recommended Posts

Hello,

 

I'm trying to retreive some smarty variable in PHP. On WHMCS 7.7 I retrieved user email using

$email = $template->getVariable('clientsdetails')->value['email'];

Now in the latest WHMCS version (8), I'm getting the following error :

 

Quote

Error: Call to a member function getVariable() on null in /var/www/template_c/7bb3185f7630a21a9cdaca2b3fb5131a64516058_0.file.custom_navbar.tpl.php:227
Stack trace:
#0 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_60cb06b8dffb69_70745100()
#1 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
#2 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()
#3 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(385): Smarty_Internal_Template->render()
#4 /var/www/template_c/ebb211ea44228453b199618d0eda25e0bc50e166_0.file.header.tpl.php(47): Smarty_Internal_Template->_subTemplateRender()
#5 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_60c31e97b6e1f6_63496519()
#6 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
#7 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()
#8 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render()
#9 /var/www/html/example.com/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()
#10 /var/www/html/example.com/vendor/whmcs/whmcs-foundation/lib/Smarty.php(0): Smarty_Internal_TemplateBase->fetch()
#11 /var/www/html/example.com/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): WHMCS\Smarty->fetch()
#12 /var/www/html/example.com/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): WHMCS\ClientArea->outputWithoutExit()
#13 /var/www/html/example.com/vendor/whmcs/whmcs-foundation/lib/Http/Message/AbstractViewableResponse.php(0): WHMCS\ClientArea->getOutputContent()
#14 /var/www/html/example.com/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(41): WHMCS\Http\Message\AbstractViewableResponse->getBody()
#15 /var/www/html/example.com/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(31): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emitBody()
#16 /var/www/html/example.com/index.php(0): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emit()
#17 {main}

 

Thanks

Link to comment
Share on other sites

  • 1 year later...

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