Jump to content

Adding variables to pages


Chris Poulter

Recommended Posts

Hi,

 

Another quick question - any responses appreciated! I would like to add a table to the client area home page that lists the clients products/services. However, this requires the $service variable which is not passed to that page by default. Is there any way of adding this variable to the page?

 

All the best,

 

Chris

Link to comment
Share on other sites

  • 1 year later...
Hi,

 

Another quick question - any responses appreciated! I would like to add a table to the client area home page that lists the clients products/services. However, this requires the $service variable which is not passed to that page by default. Is there any way of adding this variable to the page?

 

All the best,

 

Chris

 

since whmcs code encrypted I can assume they assigning variables specifically for every page

so putting

{foreach key=num item=service from=$services}
...
{/foreach}

wont solve the problem

 

instead you need to get the data and assign it for specific page/template

changing the code of clientarea.php is impossible so you need to change clientareahome.tpl

 

lets say something like this:

 

{php}
//here you are searching for all services, that belongs to logged client
$result = select_query("tblhosting", "id, domain, regdate, packageid", array("userid" => $_SESSION['uid']));

while ($row = mysql_fetch_array($result)) {
   //you need to find corresponding product for every row, cause it doesnt have product names
}

//then you have to assign result to a smarty variable
$this->_tpl_vars['user_services'] = $your_result;
{/php}

 

below in template you can use that variable {$user_services}

thats a basic code mockup, not finished, I didnt test anything, also you may try to use internal API instead, but it returns XML, so it would be harder to parse it

 

regards.

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