CenterWeb Posted January 25, 2023 Share Posted January 25, 2023 Hello. I created 2 pages: page.php /public_html page .tpl /temaplates/mytemplate It looks good, but where do I add the text? This is how it looks page.php and page.tpl <?php use WHMCS\Authentication\CurrentUser; use WHMCS\ClientArea; use WHMCS\Database\Capsule; define('CLIENTAREA', true); require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->setPageTitle('Termeni și Condiții '); $ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname')); $ca->addToBreadCrumb('termeni-si-conditii.php', 'Termeni și Condiții'); $ca->initPage(); //$ca->requireLogin(); // Uncomment this line to require a login to access this page // To assign variables to the template system use the following syntax. // These can then be referenced using {$variablename} in the template. //$ca->assign('variablename', $value); $currentUser = new CurrentUser(); $authUser = $currentUser->user(); // Check login status if ($authUser) { /** * User is logged in - put any code you like here * * Use the User model to access information about the authenticated User */ $ca->assign('userFullname', $authUser->fullName); $selectedClient = $currentUser->client(); if ($selectedClient) { /** * If the authenticated User has selected a Client Account to manage, * the model will be available - put any code you like here */ $ca->assign( 'clientInvoiceCount', $selectedClient->invoices()->count() ); } } else { // User is not logged in $ca->assign('userFullname', 'Guest'); } /** * Set a context for sidebars * * @link http://docs.whmcs.com/Editing_Client_Area_Menus#Context */ //Menu::addContext(); /** * Setup the primary and secondary sidebars * * @link http://docs.whmcs.com/Editing_Client_Area_Menus#Context */ # Define the template filename to be used without the .tpl extension $ca->setTemplate('termeni-si-conditii.tpl'); $ca->output(); 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted January 25, 2023 Share Posted January 25, 2023 You would add your HTML inside of /templates/<your theme>/termeni-si-conditii.tpl. The $ca->setTemplate function specifies the name of the template file to be used for the page. 0 Quote Link to comment Share on other sites More sharing options...
CenterWeb Posted January 29, 2023 Author Share Posted January 29, 2023 I found what needs to be added to mypage.tpl and it doesn't work. What am I doing wrong? <h3>This is my custom WHMCS page's content</h3> <p>I used the code found <a href="https://developers.whmcs.com/advanced/creating-pages/" target="_blank" title="Click here to navigate to WHMCS Support to obtain the code needed for creating a custom page.">here</a>.</p> <p>I put that code into a file named: </p> <p><code>termeni-si-conditii.php</code>, which resides in the root directory (where my WHMCS is installed).</p> <p>Now, I can write HTML into the file named:</p> <p><code>termeni-si-conditii.tpl</code>, located in the templates/six/ directory. Any HTML I save into that file, will be displayed on my new custom page.</p> 0 Quote Link to comment Share on other sites More sharing options...
CenterWeb Posted March 3, 2023 Author Share Posted March 3, 2023 (edited) WHERE CAN ADD TEXT!!!!!???? Edited March 4, 2023 by CenterWeb 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted March 4, 2023 Share Posted March 4, 2023 You don't put .tpl in the $ca->setTemplate() function. 1 Quote Link to comment Share on other sites More sharing options...
CenterWeb Posted March 4, 2023 Author Share Posted March 4, 2023 Now it works perfectly. THANK YOU! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.