Custom page in whmcs

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

  1. Navigate to the WHMCS Template Directory:
    • Access your WHMCS installation directory via FTP or File Manager.
    • Go to: whmcs/templates/[your-active-template]/
  2. 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.
  3. 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

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

  1. Edit the Header Template:
    • Open the header.tpl file located in your active template folder:
      whmcs/templates/[your-active-template]/header.tpl.
  2. 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.
  • Check for Errors:
    • Ensure the page displays as expected and fix any errors or layout issues by adjusting the .tpl or .php files.

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

https://modulesgarden.in