How to create a custom page in WHMCS
Creating a custom page in WHMCS involves editing the template files and adding your own content. Here’s a step-by-step guide to help you create a custom page:
Step 1: Create the Custom Page Template
- Navigate to the WHMCS Template Directory:
- Access your WHMCS installation directory via FTP or File Manager.
- Go to:
whmcs/templates/[your-active-template]/
- Create a New Template File:
- In the template directory, create a new
.tpl
file for your custom page. For example:custompage.tpl
. - In this
.tpl
file, you can add your custom HTML, CSS, or any Smarty template tags that WHMCS supports.
- In the template directory, create a new
- Add Content to the Template:
- Add the content you want to display on your custom page. For example:
<h1>Welcome to the Custom Page</h1>
<p>This is a custom page in WHMCS.</p>
Step 2: Create a PHP File to Display the Page
- Go to the Root Directory:
- Go to the root of your WHMCS installation.
- Create a New PHP File:
- Create a new PHP file that will be responsible for loading the template. For example:
custompage.php
. - Add the following code to this file
- Create a new PHP file that will be responsible for loading the template. For example:
<?php
use WHMCS\ClientArea;define(“CLIENTAREA”, true);
require(“init.php”);$ca = new ClientArea();
$ca->setPageTitle(“Custom Page”);// Specify the template file you created
$ca->setTemplate(“custompage”);$ca->output();
?>
Step 3: Add the Page to Your WHMCS Menu (Optional)
To add your custom page to the main navigation menu:
- Edit the Header Template:
- Open the
header.tpl
file located in your active template folder:
whmcs/templates/[your-active-template]/header.tpl
.
- Open the
- Add a Menu Item:
- Add a link to your new custom page:
<li><a href=”custompage.php”>Custom Page</a></li>
Step 4: Test the Custom Page
- Visit Your Website:
- Open your browser and go to
yourdomain.com/custompage.php
to see your new custom page.
- Open your browser and go to
- Check for Errors:
- Ensure the page displays as expected and fix any errors or layout issues by adjusting the
.tpl
or.php
files.
- Ensure the page displays as expected and fix any errors or layout issues by adjusting the
Customizing Further
You can extend this page by adding forms, integrating WHMCS data, or applying specific styles using CSS within the template file.
Need Help? Contact us:
+91 98826 06526
Web.Expert1380
+91 98826 06526
FaceBook
support@modulesgarden.in