Jump to content

Creating Custom Pages


KyleJ144

Recommended Posts

Hey

I have bee trying for hours on how to create my own custom page as i want to create an "about us" page and when i follow any tutorial then i receive the 404 error code when trying to load the page, so i don't know if i am doing it correctly.

 

Help is greatly appreciated and thanks in advance 

Link to comment
Share on other sites

21 hours ago, KyleJ144 said:

I have bee trying for hours on how to create my own custom page as i want to create an "about us" page and when i follow any tutorial then i receive the 404 error code when trying to load the page, so i don't know if i am doing it correctly.

did you follow the instruction in the documentation...?

https://developers.whmcs.com/advanced/creating-pages/

you basically just need a .php (similar to the one above) in the WHMCS root folder and a template in your active /templates/ folder (e.g Six).

as a VERY basic example, imagine you put a 'kyle.php' file in your WHMCS folder, which contains the following code...

<?php

use WHMCS\ClientArea;

define('CLIENTAREA', true);

require __DIR__ . '/init.php';

$ca = new ClientArea();
$ca->setPageTitle('Your Page Title Goes Here');
$ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname'));
$ca->addToBreadCrumb('kyle.php', 'Your Custom Page Name');
$ca->initPage();
$ca->setTemplate('kyle');
$ca->output();

and in /template/six/ you add a 'kyle.tpl' template that just contains...

hello world

when you then visit kyle.php in the browser, you should see...

pOyq9vJ.png

as I said previously, this is a VERY basic example because i've removed the database/sidebar/loggedin features.... depending on what you want to do, you may need to add some of those features back in... but you should at least be able to create new pages now. :idea:

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated