/ /website-builder/ /extensions/ /module-integration/ /order-form/

# Create Custom Page

In this article, we will walk you through the process of creating a custom page for our Lagom WHMCS Client Theme. Please note that building your own custom page requires basic HTML/PHP knowledge. WHMCS allows you to manually create custom pages for WHMCS templates. If you wish to find out more, please refer to WHMCS documentation (opens new window).

# Prepare Page Files

# Create Configuration File

  1. Log in to your WHMCS server.
  2. Create a .php file in the main WHMCS directory on your server. The name of this file will be visible in the page URL. In our example, the file will be named custom-page.php.
  3. Open the newly added .php file and enter the below code:
<?php

use WHMCS\ClientArea;
use WHMCS\Database\Capsule;

define('CLIENTAREA', true);
require __DIR__ . '/init.php';
$ca = new ClientArea();

$ca->setPageTitle('Your Page Title Goes Here');
$ca->initPage();

//$ca->assign('custompage', 'full'); // Uncoment this line if you'd like your page to be full width, it is necessary for pages like: https://lagom.rsstudio.net/demo-whmcs/index.php?rp=/store/website-builder
//$ca->requireLogin(); // Uncomment this line to require a login to access this page

# Define the template filename to be used without the .tpl extension
$ca->setTemplate('custom-page');
$ca->output();
  1. Edit the page title by changing Your Page Title Goes Here in the following code line $ca->setPageTitle('Your Page Title Goes Here');.
  2. Define the template file name to be used without the .tpl extension in this code line $ca->setTemplate('custom-page');.

# Create Template File

  1. Create a .tpl file in the /templates/lagom2 folder. The file name should be the same as the value which you have configured in step 5. In our case, it will be custom-page.tpl.
  2. Provide your HTML code in the custom page template file, for example:
<h3>Hello World!</h3>
<p>This is my first custom WHMCS page</p>
  1. The newly added page will be available under the following URL https://www.your-domain-name.com/custom-page.php.

  2. To ensure the page appears in the pages list within our addon, you must create a template for it. Please refer to the Create New Page Template (opens new window) article for detailed instructions.