I encountered a problem when I upgraded WHMCS 5 to WHMCS 6 on one of my custom templates.
One of the template migration instructions for PHP blocks as stated HERE is below:
EXAMPLE:
{php}
// Retrieve a single template variable.
$myValue = $this->_tpl_vars['myVariable'];
// Loop through all template variables.
foreach ($this->_tpl_vars as $key => $value) {
echo "{$key}: {$value}";
}
// Assign a new template variable.
$this->assign('myNewVariable', 'myNewValue');
{/php}
Converts to:
{php}
// Retrieve a single template variable.
$myValue = $template->getVariable('myVariable')->value;
// Loop through all template variables.
foreach ($template->getTemplateVars() as $key => $variable) {
echo "{$key}: {$variable->value}";
}
// The assign() method works as it did before, though it must now be
// called on the $template object instead of $this.
$template->assign('myNewVariable', 'myNewValue');
{/php}
Now the problem is this. How will I convert a multi-dimensional $this->_tpl_vars ? Or to be more specific, how will I convert a code that looks like this:
$email = $this->_tpl_vars['clientsdetails']['email'];
I was looking at the new $client Object, but not sure how to use it either and how to retrieve the email info from it.
Hope anybody can help me. Thanks!
Aucun commentaire:
Enregistrer un commentaire