Jump to content

Keval Bhogayata

  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Keval Bhogayata

  • Rank
    Junior Member
  1. Keval Bhogayata

    Concatenation in Variable Names in .tpl files

    I came across some of the mistakes I have made in syntax. Thank you.
  2. I am passing some of the variables to the .tpl file from php file using concatenation as given below: while($row=mysqli_fetch_assoc($run_field)) { foreach($row as $rows) { $response_field = array( 'extraVariable1'.$i => $row['id'], 'extraVariable2'.$i => $row['name'], ); } $finalarray_field=$finalarray_field+$response_field; $i++; } return array( 'tabOverviewReplacementTemplate' => $templateFile, 'templateVariables' => $finalarray_field, ); Now, I want to show this values in .tpl file. Is there any way so that I can print all the variables using loops (so that I should not have to write repeatedly as {extraVariable11}, {extraVariable12},.... and so on).
  3. I have found a solution for the issue that I would like to share: I modified my code to one given here: $finalarray=array(); $response=array(); $i=1; while($row=mysqli_fetch_assoc($run)) { foreach($row as $rows) { $response = array( 'extraVariable1'.$i => $row['id'], 'extraVariable2'.$i => $row['name'], 'extraVariable3'.$i => $row['email'], ); } $finalarray=$finalarray+$response; $i++; } return array( 'tabOverviewReplacementTemplate' => $templateFile, 'templateVariables' => $finalarray, ); and then in .tpl file I wrote this: {$extraVariable11} {$extraVariable21} {$extraVariable31} {$extraVariable12} {$extraVariable22} {$extraVariable32} {$extraVariable13} {$extraVariable23} {$extraVariable33} The next problem I am facing is : how to make my variable name dynamic in .tpl file so that I can do the above task using loop?
  4. I understood the concept, but still I am having the same problem. Can you show me how should I show these variables in my .tpl file?
  5. Understood, is there any platform where I can get a paid course for the same?
  6. try { // Call the service's function based on the request action, using the // values provided by WHMCS in `$params`. $conn=mysqli_connect("localhost","admin1","admin","hello"); $query="SELECT * FROM t_hello"; $run=mysqli_query($conn,$query); while($row=mysqli_fetch_assoc($run)) { $set1=$row['id']; $set2=$row['name']; $set3=$row['email']; //$response = array(); return array( 'tabOverviewReplacementTemplate' => $templateFile, 'templateVariables' => array( 'extraVariable1' => $set1, 'extraVariable2' => $set2, 'extraVariable3' => $set3, ), ); } } catch (Exception $e) { // Record the error in WHMCS's module log. logModuleCall( 'provisioningmodule', __FUNCTION__, $params, $e->getMessage(), $e->getTraceAsString() ); // In an error condition, display an error page. return array( 'tabOverviewReplacementTemplate' => 'error.tpl', 'templateVariables' => array( 'usefulErrorHelper' => $e->getMessage(), ), ); } I have used the above given code to fetch data from my database. But, I do not know how to pass it to .tpl file. The code of .tpl file is as follows. {$extraVariable1} {$extraVariable2} {$extraVariable3} The output shows me only the first record of my table. Where is the problem?
  7. I am a newbie in WHMCS. I have come across some of the provisioning modules that are available online, but I am having issues with the flow of logisc. If anyone can suggest a course or tutorial it will be great. I also wanted to know if I can get these things for free. Thank you.
  8. Ok, got it. Thanks again.
  9. Thank you very much, it worked for me. How to know which action will be triggered on which client area buttons/links if you can help?
  10. I have already downloaded similar module earlier, but I do not know how to include and run php code inside .tpl file.
  11. I know how to add provisioning modules in WHMCS. But how to hook my custom .tpl (which are inside my module) files with WHMCS. Also php code inside my .tpl files do not show any effect (Only html tags are executed).
  12. Welcome to WHMCS.Community Keval Bhogayata! We're glad you're here please take some time to familiarise yourself with the Community Rules & Guidelines and take a moment to introduce yourself to other WHMCS.Community members in the Introduce Yourself Board.


Important Information

By using this site, you agree to our Terms of Use & Guidelines