Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function retrieves another file's contents for display.

Warning:

This function is for the x3 theme only. You cannot call it successfully from the Paper Lantern theme. Because of this, we strongly recommend that you do not use this function.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Branding/include?file=dynamiccontent.html&skipdefault=0&raw=0

Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Display dynamiccontent.html's contents.
$include_path = $cpanel->uapi(
    'Branding', 'include',
    array(
      'file'          => 'dynamiccontent.html',
      'skipdefault'   => '0',
      'raw'           => '0',
    )
);

Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Display dynamiccontent.html's contents.
my $include_path = $cpliveapi->uapi(
    'Branding', 'include',
    {
      'file'          => 'dynamiccontent.html',
      'skipdefault'   => '0',
      'raw'           => '0',
    }
);

Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Get the include URL. -->
[% execute('Branding', 'include', { 'file' => 'dynamiccontent.html', 'skipdefault' => '0', 'raw' => '0', } ) %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username Branding include file=dynamiccontent.html skipdefault=0 raw=0 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

   },
   "data":"My file's contents.\n"
}


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
filestring

Required

The file.

A file path, relative to the /usr/local/cpanel/base/appname/theme/branding directory, where:

  • appname is webmail if the caller authenticated through Webmail, or frontend if the caller authenticated through cPanel.
  • theme is the user's theme (x3).
dynamiccontent.html
skip_defaultBoolean

Whether to search only custom themes.

This parameter defaults to 0.

  • 1 — Search only custom themes.
  • 0 — Search cPanel's default themes.
0
rawBoolean

Whether to process the file's contents.

This parameter defaults to 0. 

  • 0 — Process the file's contents.
  • 1 — Display the file's raw contents.
0

Returns

ReturnTypeDescriptionPossible valuesExample
datastring

The file's contents.

The full contents of the file parameter's file.

My file's contents.\n