using standard header templates in my WHM app

rustyhex

Member
Jul 18, 2013
10
0
1
cPanel Access Level
Root Administrator
Still does not work. I put my templates to:
/usr/local/cpanel/whostmgr/docroot/templates/MY_ADDON
Then i use TemplateToolkit's process with
INCLUDE_PATH = /usr/local/cpanel/whostmgr/docroot/templates/MY_ADDON
in my addon_*.cgi.
I've tried to put my templates to /usr/local/cpanel/whostmgr/docroot/templates, but nothing happened.
 

AndrewH.

Well-Known Member
Dec 10, 2012
52
3
83
cPanel Access Level
Root Administrator
Here's a breakdown since I recently went through the process of dropping something into WHM.

Template file goes into: /usr/local/cpanel/whostmgr/docroot/templates

Wrap it with this(you can remove scripts / stylesheets if you aren't using any external ones):

[%
USE Whostmgr;
WRAPPER 'master_templates/master.tmpl'
stylesheets = [
]
scripts = [
]
-%]

<!--HTML/Template CONTENT -->

[% END %]
This uses the latest WHM Master template, the _defheader is something we're moving away from. Now when we call Templates we have to use Cpanel::Template and it usually looks like this...
Cpanel::Template::process_template(
'whostmgr',
{
'template_file' => 'sometemplate.tmpl'
},
);
The breadcrumbs / heading is based on the /usr/local/cpanel/whostmgr/docroot/themes/x/command2 file which I believe is modified when you register the plugin and appropriate files are regenerated. My knowledge of WHM plugin development is a little fuzzy so I'll try and investigate for you.

edit: Here's a pastebin link since the formatting gets destroyed in this: http://pastebin.com/Fqq3MUvp
 
Last edited:

rustyhex

Member
Jul 18, 2013
10
0
1
cPanel Access Level
Root Administrator
It helped, thanks. Works from my CGI's, but it does not work from addon_myWHMaddon.cgi. There's no errors in cpanel error log, but process_template displays a blank page.