# 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:

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->assign('custompage', 'full'); // Uncoment this line if you'd like your page to be full width, it's 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
  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