Jump to content

Accessing other template's variables


jrianto

Recommended Posts

I am trying to create some custom application within WHMCS. I am having some problem trying to figure out to display other template's client variables within my custom pages.

 

For example, I see on clientareahome.tpl file, there is a variable {$stats.creditbalance}

 

I tried using this variable in my own custom file agent.tpl, but its value does not show up.

 

That is just one example, I am trying to create an application within WHMCS which needs to access various variables which I already see on your other template files. For example, I would also need to display some orders variables, transaction variables, invoices variables, etc, etc.

 

How do I make all these variables accessible from my custom template file? So I can refer to other templates on using this variables and have the values show up.

Link to comment
Share on other sites

Thanks J. I am aware of the {debug} directive, but what I am trying to do is to actually access variables available on OTHER template files.

 

For example, I am trying to display the value of {$stats.creditbalance} which is available on the clientareahome.tpl template.

 

How do I display that value on my own template file?

Link to comment
Share on other sites

The codes you see with the {debug} tag are the only ones that WHMCS populates for the specific template.

 

If you want to use any others then you have to recreate what WHMCS does and get the information yourself through a DB query using php tags or an external file.

 

The easiest way is to probably execute the query via WHMCS's own db functions within the template using {php} codes.

Link to comment
Share on other sites

How do I access the smarty array variables within the {php} section?

 

For example:

{php}

$custlanguage = $this->get_template_vars('language');

 

print "$custlanguage";

{/php}

 

That will display "English". But what if the smarty variable is an array like {$clientsdetails}. I tried using:

$custfirstname = $this->get_template_vars('clientsdetails->firstname');

$custfirstname = $this->get_template_vars('clientsdetails[0]');

 

Both does not work. Any help would be appreciated.

 

Thanks

Link to comment
Share on other sites

  • 7 months later...
  • 2 weeks later...

If I wanted to be able to use the $domain.idprotectionprice variable in viewcart template, what would I use?

 

I tried $this->_tpl_vars['configuredomains']['domain']['idprotectionprice']

 

but that didn't work.

 

Thanks for any help

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.

  • 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