Jump to content

Recommended Posts

Since 2009 I'm asking for it but no aswer at all. I've been trying ticket support, forum threads and never has a final aswer. Too boring.

 

I want a way to create templates files without default header and footer.

For now I'm using condition to hide the footer and header content. This is really bad because when WHMCS update versions I have to do all the customized settings again.

 

So I would like to know a way to create new pages in WHMCS at other template folder.

 

I can't use resource like:

http://www.yourdomain.com/whmcs/?systpl=xxxxx because it keeped in cookie and changed the template for all site.

 

Other way was from this resource: http://www.smarty.net/docsv2/en/template.resources.tpl#templates.from.any.dir

 

$ca->setTemplate('file:/path/to/newdir/custom.tpl');

Then in the TPL file, you have something like this:

{include file='file:/usr/local/share/templates/yourtemplate.tpl'}

 

But didnt work.... The header and footer coming together too.

 

I really need this because I can't create new pages easy in WHMCS system.

 

Now i opened a request at: https://requests.whmcs.com/topic/change-template-folder-directory

 

 

 

 

Thanks

Davi

Link to comment
Share on other sites

Here what I would do, If I understood your issue correct,

 

 

 

1- Create new template files named "myheader.tpl" and "myfooter.tpl" and put them inside [templates/mytemplate/includes]

2- Copy the content that inside header.tpl (maybe not all of it,right after the <body> tag till the end of the file) and paste it inside [myheader.tpl], so the header.tpl will be embty of the visible content.

3- Do the same for the footer and put its content into myfooter.tpl.

4- So, now all your site works but there is no header and footer, it's just the main content, (this is the default for all templates)

5- Now, if you want some pages to have header and footer, let's say you want the clientarea home page to get header and footoer. Go open clientareahome.tpl and put in the top of the file :

{include file="$template/includes/myheader.tpl"}

and in the end of the file :

{include file="$template/includes/myhfooter.tpl"}

 

Now, all your site pages has no header or footer, the only page has them is (clientareahome.tpl) which is (yoursite.com/clientarea.php) .. you can add header and footer for any other templates file you want to get the header and footer..

 

 

hope that's help

Link to comment
Share on other sites

  • 3 weeks later...

Thanks for your answer, much better than WHMCS support tickets, this works but is really hard to maintain, new version of WHMCS I need to do this again and again...

 

I'm almost there using this help: https://stackoverflow.com/questions/34765796/change-whmcs-template-from-hook/34936789#34936789

 

 

But the deal is that bring back the default layout, I want to show only couple pages in other templates, because the all sites still need open the default template setting in admin general settings.

 

I really don't understand why WHMCS support team not helping for it!

 

 

thanks i will still trying to get it done!

Link to comment
Share on other sites

The fastest and easiest way to do this is to use smarty variables. FAR less code, no messing with anything

 

Step 1:

Add

$ca->assign("notemplateheaderfooter", '1');

to your custom page

 

Step 2:

in the template files (header, footer), add

{if !$notemplatefooter}

to the beginning

and

{/if}

to the end

 

There you go. Now, all pages will have headers included, and only the content will be shown if the page doesn't include the variables.

 

You're going to have to just man up and make the changes on template updates, unfortunately. This, however, is the easiest way to go about that.

 

Alternatively, you could use your own template (simple as copying the 'six' directory to 'seven' then updating the template in the admin area), and apply the changes to that, then update WHMCS templates manually when new versions arise.

 

Either way you look at it, you're going to have to do some work. You chose the customization, it means you have to do a bit of work on updates. WHMCS isn't going to hold your hand and do it for you.

 

- - - Updated - - -

 

Alternatively , you could make the changes I recommended above and then fix it so that nobody could write to header and footer.tpl... Change the permissions for the files themselves. It's not like those files should ever be overwritten that often ;)

Link to comment
Share on other sites

Thanks for your answers!!! I got a solution from WHMCS ticket!!!

 

<?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['_REQUEST']['systpl'] = 'five';

require("init.php");

// WHATEVER YOU ARE DOING IN HERE

// Set the session back to the default template:
$GLOBALS['_SESSION']['Template'] = 'six'; 

$ca->output();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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