UAPI Functions - Chrome::get_dom

Description

This function returns header and footer HTML. You can use this HTML to create a page with the same visual appearance as your cPanel theme.

Examples 


 cPanel or Webmail Session URL

https://hostname.example.com:2083/cpsess##########/execute/Chrome/get_dom?page_title=Test

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Generate headers and footers for the page "Test"
$get_dom $cpanel->uapi(
    'Chrome''get_dom',
    array(
        'page_title'    => 'Test',
    )
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
#  Generate headers and footers for the page "Test"
my $get_dom $cpliveapi->uapi(
    'Chrome''get_dom',
    {
        'page_title'    => 'Test',
    }
);

 cPanel Template Toolkit

<!--   Generate headers and footers for the page "Test" -->
[% data = execute( 'Chrome', 'get', { page_title => 'Test'} ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]

 Command Line

uapi --user=username Chrome get_dom page_title=Test

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

{
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
     
  },
  "data": {
    "footer": "\n
</div><!-- end body-content -->\n
 </div>\n
 <!-- PAGE TEMPLATE'S CONTENT END -->\n
 </div>\n\n        <footer>\n
 <!-- UI INCLUDES GLOBAL FOOTER -->\n
 <!-- UI INCLUDES GLOBAL FOOTER END -->\n\n
 <div class=\"container\">\n
 <div class=\"navbar\">\n
 <ul class=\"nav navbar-nav\">\n
 <li>\n
 <a id=\"lnkFooterHome\" href=\"../index.html\">Home                            </a>\n
 </li>\n
 <li>\n
 <a id=\"lnkFooterTrademark\" href=\"../trademarks.html\" target=\"_blank\">Trademarks                            </a>\n
 </li>\n
 <li>\n
 <a id=\"lnkFooterDocs\" href=\"http://go.cpanel.net/paperlanterndocs\" target=\"_blank\">Documentation                            </a>\n
 </li>\n
 <li>\n
 <a id=\"lnkFooterContact\" href=\"../contact/contactinfo.html\" target=\"_blank\">Contact                            </a>\n
 </li>\n
 </ul>\n\n
 <div class=\"navbar-brand\" style=\"display:inline-block; z-index:2147483647; visibility:visible;\">\n
 <a id=\"lnkPoweredByCpanel\" href=\"http://www.cpanel.net\" target=\"cpanel\" title=\"cPanel, Inc.\" style=\"display:inline-block; z-index:2147483647; visibility:visible;\">\n
 <img id=\"imgPoweredByCpanel\" src=\"/img-sys/powered_by_cpanel.png\" alt=\"cPanel, Inc.\" style=\"display:inline-block; z-index:2147483647; visibility:visible;\">\n
 </a>\n
 </div>\n
 </div>\n
 </div>\n
 </footer>\n\n
 <script type=\"text/javascript\">\n
 CPANEL.lang.close=\"Close\";CPANEL.lang.Close=\"Close\";CPANEL.lang.cancel=\"Cancel\";CPANEL.lang.unlimited=\"Unlimited\";CPANEL.lang.or=\"or\";CPANEL.lang.ajax_loading=\"Loading \u2026\";CPANEL.lang.password_generator=\"Password Generator\";CPANEL.lang.generate_password=\"Generate Password\";CPANEL.lang.advanced=\"Advanced Options\";CPANEL.lang.confirm_copy_password=\"I have copied this password in a safe place.\";CPANEL.lang.use_password=\"Use Password\";CPANEL.lang.length=\"Length\";CPANEL.lang.alpha_characters=\"Alpha Characters\";CPANEL.lang.nonalpha_characters=\"Non Alpha Characters\";CPANEL.lang.both=\"Both\";CPANEL.lang.lowercase=\"Lowercase\";CPANEL.lang.uppercase=\"Uppercase\";CPANEL.lang.numbers=\"Numbers\";CPANEL.lang.symbols=\"Symbols\";CPANEL.lang.password_strength=\"Password Strength\";CPANEL.lang.passwords_match=\"Passwords Match\";CPANEL.lang.password_validator_strength=\"Password strength must be at least:\";CPANEL.lang.password_validator_no_spaces=\"Password cannot have spaces.\";CPANEL.lang.password_validator_no_empty=\"Password cannot be empty.\";CPANEL.lang.password_validator_no_match=\"Passwords do not match.\";CPANEL.lang.Validation_Errors=\"Validation Errors\";CPANEL.lang.strength_phrase_very_weak=\"Very Weak\";CPANEL.lang.strength_phrase_weak=\"Weak\";CPANEL.lang.strength_phrase_ok=\"OK\";CPANEL.lang.strength_phrase_strong=\"Strong\";CPANEL.lang.strength_phrase_very_strong=\"Very Strong\";CPANEL.lang.click_to_close=\"Click to close.\";CPANEL.lang.toggle_more=\"more \u00bb\";CPANEL.lang.toggle_less=\"less \u00bb\";CPANEL.lang.Error=\"Error\";CPANEL.lang.json_error=\"Error\";CPANEL.lang.json_parse_failed=\"JSON parse failed.\";CPANEL.lang.ajax_error=\"AJAX Error\";CPANEL.lang.ajax_try_again=\"Please refresh the page and try again.\";CPANEL.lang.Search=\"Search\";CPANEL.lang.Simple_Search=\"Simple Search\";CPANEL.lang.Advanced_Search=\"Advanced Search\";CPANEL.lang.add_search_field=\"add search field\";CPANEL.lang.remove=\"remove\";CPANEL.lang.No_Results_Found=\"No Results Found\";CPANEL.lang.Go_to=\"Go to\";CPANEL.lang.Show_rows=\"Show rows\";CPANEL.lang.contains=\"contains\";CPANEL.lang.equals=\"equals\";CPANEL.lang.More=\"More\";CPANEL.lang.ajax_error_with_image=CPANEL.icons.error+\" \"+this.ajax_error+\": \"+this.ajax_try_again;CPANEL.lang.json_error_with_image=CPANEL.icons.error+\" \"+this.json_error+\": \"+this.ajax_try_again;\n
 </script>\n
 \n
 <script type=\"text/javascript\">\n
 $(function(){\n\n
 var img = $(\"#imgPoweredByCpanel\");\n
 if(img === null || img.length <= 0 ||\n
 img.attr('src') !== \"/img-sys/powered_by_cpanel.png\") {\n
 window.location=\"/\";\n
 }\n\n
 // Warning Duplicate IDs\n
 $('[id]').each(function(){\n
 var ids = $('[id=\\''+this.id+'\\']');\n
 if(ids.length>1 && ids[0]==this) {\n                    console.warn('Multiple IDs #'+this.id);\n
 }\n\n
 });\n
 });\n
 </script>\n
 </body>\n
</html>\n\n",
    "header": "\n\n
<!DOCTYPE html>\n\n<html lang=\"en\" dir=\"ltr\">\n
 <head>\n
 <title>cPanel - Test</title>\n
 <meta charset=\"utf-8\" />\n
 <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n
 <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n
 <link rel=\"shortcut icon\" href=\"/brand/favicon.ico?96992846\" type=\"image/x-icon\" />\n\n
 <link rel=\"stylesheet\" type=\"text/css\" href=\"/cPanel_magic_revision_1395856329/frontend/paper_lantern/css/yui-core.css\" />\n
 <link rel=\"stylesheet\" type=\"text/css\" href=\"/cPanel_magic_revision_1409853723/frontend/paper_lantern/css/yui-custom.css\" />\n
 <link rel=\"stylesheet\" type=\"text/css\" href=\"/cPanel_magic_revision_1392312282/frontend/paper_lantern/3rdparty/bootstrap/optimized/css/bootstrap.min.css\" />\n
 \n
 <link rel=\"stylesheet\" type=\"text/css\" href=\"/cPanel_magic_revision_1386192030/frontend/paper_lantern/3rdparty/ui-fonts/open_sans/optimized/open_sans.min.css\" />\n
 <link rel=\"stylesheet\" type=\"text/css\" href=\"/cPanel_magic_revision_1383654921/frontend/paper_lantern/3rdparty/fontawesome/css/font-awesome.min.css\" />\n
 <link rel=\"stylesheet\" type=\"text/css\" href=\"/cPanel_magic_revision_1414439806/frontend/paper_lantern/css/cpanel_base.min.css\" />\n\n
 <script type=\"text/javascript\" src=\"/cPanel_magic_revision_1374783460/frontend/paper_lantern/3rdparty/jquery/1.10.2/jquery-1.10.2.min.js\"></script>\n
 <script type=\"text/javascript\" src=\"/cPanel_magic_revision_1392312282/frontend/paper_lantern/3rdparty/bootstrap/optimized/js/bootstrap.min.js\"></script>\n
 <script type=\"text/javascript\" src=\"/cPanel_magic_revision_1389045136/yui-gen/utilities_container/utilities_container.js\"></script>\n
       <script type=\"text/javascript\" src=\"/cPanel_magic_revision_1409244679/frontend/paper_lantern/js/x3_optimized.js\"></script>\n
 <script type=\"text/javascript\" src=\"/cPanel_magic_revision_1414435557/cjt/cpanel-all-min-en.js\"></script>\n
 <script type=\"text/javascript\">\n
 CPANEL.validate.hide_validation_summary = true;\n
 </script>\n
 \n
 <script type=\"text/javascript\">\n
 (function(){\n
 window.PAGE = {};\n                window.NVData = {};\n
 window.thisTheme = \"paper_lantern\";\n\n
 })();\n
 </script>\n\n        <!-- custom style css file (styles.css) should go here -->\n
 <link rel=\"stylesheet\" type=\"text/css\" href=\"/styled/current_style/sprites/icon_spritemap.css?96992846\" />\n
 <link rel=\"stylesheet\" type=\"text/css\" href=\"/styled/current_style/styles.css?96992846\" />\n
   </head>\n
 <body id=\"cpanel_body\" class=\"yui-skin-sam\">\n
 <div id=\"wrap\">\n
 <header>\n
 <div class=\"navbar navbar-inverse navbar-cpanel navbar-fixed-top\" role=\"navigation\">\n
 <div class=\"container\">\n
 <div class=\"navbar-header\">\n
 \n
 <a id=\"lnkHeaderHome\" class=\"navbar-brand\" target=\"_top\" href=\"../index.html\">\n
                                   <img id=\"imgLogo\" src=\"/brand/logo.png?96992846\" alt=\"\" title=\"\"/>\n
                               </a>\n
 \n
 <div class=\"navbar-preferences\">\n<div class=\"btn-group\">\n
 <button id=\"btnUserPref\" data-toggle=\"dropdown\" class=\"btn btn-primary dropdown-toggle\">\n
 <span id=\"userImg\" class=\"glyphicon glyphicon-user\"></span>\n
 <span id=\"lblUserNameTxt\" class=\"hidden-inline-xs\">example</span>\n
 <span id=\"caretImg\" class=\"caret\"></span>\n
 </button>\n
 <ul class=\"dropdown-menu dropdown-menu-right\">\n
 \n
 <li>\n
 <a id=\"lnkUserPrefChangePwd\" href=\"../passwd/index.html\">Change Password            </a>\n
 </li>\n
 \n
 \n
 <li>\n
 <a id=\"lnkUserPrefChangeLang\" href=\"../setlang/index.html\">Change Language            </a>\n        </li>\n
 \n
 \n
 <li>\n
 <a id=\"lnkUserPrefChangeStyle\" href=\"../styleswitcher/index.html\">Change Style            </a>\n
 </li>\n
 \n
 \n
 <li>\n
 <a id=\"lnkUserPrefUpdateContactInfo\" href=\"../contact/index.html\">Contact Information            </a>\n        </li>\n
 \n
 <li>\n
 <a id=\"lnkUserPrefResetInterface\" href=\"javascript:void(0)\" onclick=\"reset_all_interface_settings()\">\n
 Reset Page Settings\n
 </a>\n
 </li>\n
 </ul>\n</div>\n\n
 <a id=\"lnkHeaderLogout\" class=\"btn btn-default\" target=\"_top\" href=\"/logout/?locale=en\">\n
 <span id=\"logoutImg\" class=\"glyphicon glyphicon-log-out\"></span>\n
 <span id=\"lblLogout\" class=\"hidden-inline-xs\">Logout</span>\n
 </a>\n
 </div>\n
 </div>\n
 </div>\n
 </div>\n
 <!-- UI INCLUDES GLOBAL HEADER -->\n
 <div id=\"include-global-header\">\n<nav id=\"quickLinks\" class=\"navbar navbar-default navbar-subnav\" role=\"navigation\">\n
 <div class=\"container\">\n
 <ul class=\"nav navbar-nav\">\n
 <li>\n
 <a id=\"lnkQuickHome\" href=\"../index.html\">Home                </a>\n
 </li>\n
 <li>\n
 <a id=\"lnkQuickDomains\" href=\"../addon/index.html\">Addon Domains                </a>\n
 </li>\n
 <li>\n
 <a id=\"lnkQuickFilemgr\" href=\"../filemanager/index.html?showhidden=1&dir=/public_html\"\n
 target=\"_blank\" >File Manager                </a>\n
 </li>\n
 <li>\n
 <a id=\"lnkQuickEmail\" href=\"../mail/pops.html\">Email                </a>\n
 </li>\n
 </ul>\n
 </div>\n
</nav>\n
</div>\n
 <!-- UI INCLUDES GLOBAL HEADER END-->\n
 </header>\n
 \n
 <!-- PAGE TEMPLATE'S CONTENT START -->\n
 <div id=\"content\" class=\"container\">\n\n
 \n\n
 <h1 class=\"page-header\">\n
 <span id=\"icon-\" class=\"page-icon icon-\"></span>\n                    <span id=\"pageHeading\" >Test</span>\n
 \n
 </h1>\n
 \n
 <div class=\"body-content\">\n    "
  }
}

 

Note:

Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.

 

Parameters

 Parameter 

Type

Description

Possible values

 Example 

page_title

 string 

Required

 The title of the page to wrap in the theme's headers and footers. 

A valid string.

Note:

 The function prepends this value withcPanel - 

Test

 

Returns

 Return 

 Type 

Description

 Possible values 

header

 string 

 The pages' header. 

A valid string.

footer

string

The pages' footer.

A valid string.

 

  • 38 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....