Create Custom Page for WHMCS

Important

Lagom WHMCS theme, doesn't allow to create or manage custom pages via RS Themes addon, all those changes need to be done directly in the WHMCS and template files.

In this article we will show you an example how to create custom page for Lagom WHMCS theme, this require basic HTML/PHP knowledge. WHMCS allows to manually create custom pages for WHMCS templates it's described in WHMCS documentation.

Create configuration file

  1. Login to your WHMCS server.
  2. Create .php file inside main WHMCS directory on your server, filename of this file will be visible in page url. In our example we will name it custom-page.php.
  3. Open newly created .php file and add 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'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
$ca->setTemplate('custom-page');
$ca->output();
  1. Change the page title, by changing Your Page Title Goes Here value in this line of code $ca->setPageTitle('Your Page Title Goes Here');.
  2. Define the template filename to be used without the .tpl extension, in this line of code $ca->setTemplate('custom-page');.

Create template file

  1. Create .tpl file inside /templates/lagom folder, name of this file should be the same as value which you configured in step 5. In our example it will be custom-page.tpl.
  2. Put your HTML code with in custom page template file, for example:
<h3>Hello World!</h3>
<p>This is my first custom WHMCS page</p>
  1. Newly created page will be available under this url https://www.your-domain-name.com/custom-page.php

Note

Be sure to replace https://www.your-domain-name.com/ with your actual domain to your WHMCS root directory. Additionally, be sure to change custom-page.tpl to the actual name of the .php file you created in step 2.