Skip to main content

What’s going on in WHM?

Comments

8 comments

  • cPanelAdamF
    For PHP plugin developers who need a temporary workaround while we make changes in WHM, here's a path you could take to bring the WHM interface chrome into your plugin. Again, this is only a temporary workaround. We'll be expanding plugin support in WHM as a part of the WHM work. Stay tuned for those updates. In testPlugin.html.tt
    [% USE Whostmgr; USE JSON; IF locale.get_html_dir_attr() == 'rtl'; SET rtl_bootstrap = Whostmgr.find_file_url('/3rdparty/bootstrap-rtl/optimized/dist/css/bootstrap-rtl.min.css'); END; SET styleSheets = [ rtl_bootstrap, '/libraries/fontawesome/css/font-awesome.min.css' ]; WRAPPER 'master_templates/master.tmpl' header = locale.maketext("WHM Example Plugin") stylesheets = styleSheets, theme='bootstrap'; %] [% END %]
    In this example, the iframe's SRC value should point to the index page of your plugin. NOTE: the above code snippet widget is scrollable. Remember to copy-pasta the whole thing. In /usr/local/cpanel/whostmgr/docroot/cgi/testPlugin/index.cgi
    #!/usr/local/cpanel/3rdparty/bin/perl use strict; package cgi::examplePlugin; use warnings; use Cpanel::Template (); run() unless caller(); sub run { print "HTTP/1.0 200\r\n OK Content-type: text/html; charset=\"utf-8\"\r\n\r\n"; Cpanel::Template::process_template( 'whostmgr', { 'template_file' => 'testPlugin.html.tt', 'print' => 1, } ); exit; }
    0
  • fevangelou
    A couple of clarifications/questions if you don't mind... a) Should the file testPlugin.html.tt be saved in the /usr/local/cpanel/whostmgr/docroot/templates/ directory? b) You refer to an iframe's src attribute yet I don't see any iframe tag in the code above. Did you mean that in order to have the header brought into a plugin we should create an iframe tag containing the .cgi file as src? Thank you.
    0
  • cPanelAdamF
    a) Should the file testPlugin.html.tt be saved in the /usr/local/cpanel/whostmgr/docroot/templates/ directory?

    testPlugin.html.tt should be saved in your plugin's directory inside /usr/local/cpanel/whostmgr/docroot/templates/. Additionally you can name it whatever you'd like (not just testPlugin.html.tt).
    b) You refer to an iframe's src attribute yet I don't see any iframe tag in the code above. Did you mean that in order to have the header brought into a plugin we should create an iframe tag containing the .cgi file as src?

    You may have to scroll within the code snippet to see it.
    0
  • Harlequin
    After years of X3 I kind of miss it but hey... Progress and all that.
    0
  • fevangelou
    Thanks @cPanelAdamF (getting old I guess...)
    0
  • cPanelAdamF
    For those of you using PHP for your WHM Plugin, we've just released new parts of our SDK adding support for including the WHM header, footer, and navigation in your plugins. Here's where to go to find out more: * Guide to WHM Plugins - Interfaces - Software Development Kit - cPanel Documentation * Tutorial - Create a New WHM Interface in PHP - Software Development Kit - cPanel Documentation Please have a look and let me know if this is helpful (or how it needs to improve). Cheers!
    0
  • Dan Richert
    When I set up a PHP interface for a WHM plugin using the instructions above I'm getting this error:
    Warning: file_get_contents(/var/cpanel/caches/_generated_header_files/3060838764_0_0.html): failed to open stream: No such file or directory in /usr/local/cpanel/php/WHM.php on line 50
    How do properly generate the cached header and footer files? Thanks!
    0
  • cPanelAdamF
    When I set up a PHP interface for a WHM plugin using the instructions above I'm getting this error:
    Warning: file_get_contents(/var/cpanel/caches/_generated_header_files/3060838764_0_0.html): failed to open stream: No such file or directory in /usr/local/cpanel/php/WHM.php on line 50
    How do properly generate the cached header and footer files? Thanks!

    Dan, what version of cpanel are you running? We've updated the caching logic in a few minor build-numbers which may solve your problem. You can also run... /scripts/rebuild_whm_chrome ...manually if you ever need to directly generate the cache.
    0

Please sign in to leave a comment.