How can we improve WHMCS?

Share, discuss and vote for what you would like to see added to WHMCS

Change template folder ( directory )

  • Davi Souza shared this idea 8 years ago
  • Developers
  • 2 Comments


This request is a way to change the template folder in API, something like this:

$ca->setTemplate( 'my-new-template-file' , 'my-new-template-folder' );

Sometimes we need to create landing pages, or another way to show the products. And we want a clean template, without to many information at header and footer.

If this implemented we could have a template for each kind of products o advirtesiment , and stop using smarttemplate conditions at header and footer.

3 Comments

Login to post a comment.

I got a solution foit from WHMCS SUpporting:

<?php

use WHMCS\Database\Capsule;
use WHMCS\View\Menu\Item as MenuItem;

define("CLIENTAREA", true);

// Set the template you want to use for the custom page BEFORE init.php is called
$GLOBALS&#91;'_REQUEST'&#93;&#91;'systpl'&#93; = 'five';

require("init.php");
...
// WHATEVER YOU ARE DOING IN HERE
...
// Set the session back to the default template:
$GLOBALS&#91;'_SESSION'&#93;&#91;'Template'&#93; = 'six';

$ca->output();
This could be done as outlined on the Smarty Docs by using a template file from any directory:

http://www.smarty.net/docsv2/en/template.resources.tpl#templates.from.any.dir
Doesn't work :(

From this way, the header and footer still comming from the default template.