Jump to content
CenterWeb

Add text new page

Recommended Posts

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();

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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>

 

Share this post


Link to post
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