Jump to content

Smarty template adjustments causing blank screen


paperweight

Recommended Posts

I am upgrading our template to Smart 3.x and WHMCS 6.x. I have an issue with adding PHP to Smarty. I originally had this:

 

{php}
$userid = $this->_tpl_vars['clientsdetails']['id'];
$result = mysql_query("SELECT *,tblhosting.id as serviceid FROM tblhosting,tblproducts WHERE userid =$userid AND tblhosting.packageid= tblproducts.id AND tblhosting.domainstatus='Active'");
$services = array();
while ($data = mysql_fetch_array($result)) {
array_push($services, $data);
}
$this->_tpl_vars['services'] = $services;
{/php}

 

 

And then changed it to this, which I think is correct Smarty:

{php}
$userid = $template->getTemplateVars('clientsdetails', 'id');
$result = mysql_query("SELECT *,tblhosting.id as serviceid FROM tblhosting,tblproducts WHERE userid =$userid AND tblhosting.packageid= tblproducts.id AND tblhosting.domainstatus='Active'");
$services = array();
while ($data = mysql_fetch_array($result)) {
array_push($services, $data);
}
$template->getVariable('services') = $services;
{/php}

 

That looks correct, right? I'm getting a blank page when I load the tpl with this code on it. Any idea why?

Link to comment
Share on other sites

Also if you need to quickly fix this then as per the WHMCS upgrade documentation, http://docs.whmcs.com/Version_6.0_Release_Notes#Upgrade_to_Smarty_3

 

By default Smarty 3 disallows the use of Smarty php tags in template files. However, we know a lot of custom templates and modules rely on this functionality and so we have introduced a backwards compatibility setting in Setup > General Settings > Security named "Allow Smarty PHP Tags". This setting is disabled by default (which is recommended), but if your custom templates or installed third party addons/modules require it, you can turn it on here.
Link to comment
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.

×
×
  • 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