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

 

Description

This function retrieves a branding file's path. 

The function searches the /usr/local/cpanel/base/appname/theme/branding/ directory, where:

  • appname represents frontend if you use a cPanel session or webmail if you use a Webmail session.
  • theme represents paper_lantern, or the name of another cPanel theme on the server.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Branding/file?file=local.css&needfile=0&skipdefault=0&checkmain1=&nomagic=1

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.
 
// Get the path to the local.css file.
$file_path = $cpanel->uapi(
    'Branding', 'file',
    array(
      'file'          => 'local.css',
      'needfile'      => '0',
      'skipdefault'   => '0',
      'checkmain'     => '1',
      'nomagic'       => '1',
    )
);

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.
 
# Get the path to the local.css file.
my $file_path = $cpliveapi->uapi(
    'Branding', 'file',
    {
      'file'          => 'local.css',
      'needfile'      => '0',
      'skipdefault'   => '0',
      'checkmain'     => '1',
      'nomagic'       => '1',
    }
);

Note:

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

 cPanel Template Toolkit
<!-- Get a hash of all the data, then display the path value. -->
[% data = execute( 'Branding', 'file', { 'file' => 'local.css', 'needfile' => '0', 'skipdefault' => '0', 'checkmain' => '1', 'nomagic' => '1' } ); %]
[% FOREACH q = data.path %]
     <p>
         [% q %]
     </p>
[% END %]
 

<!-- Get only the file path. -->
[% execute('Branding', 'file', { 'file' => 'local.css', 'needfile' => '0', 'skipdefault' => '0', 'checkmain' => '1', 'nomagic' => '1' } ).data.path %]

Note:

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

 Command Line
uapi --user=username Branding file file=local.css needfile=0 skipdefault=0 checkmain=1 nomagic=1

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":{  
      "type":"cphtml",
      "path":"/usr/local/cpanel/base/frontend/paper_lantern/branding/local.css",
      "uri":"/cPanel_magic_revision_1327526145/frontend/paper_lantern/branding/local.css"
   }
}

Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
filestring

The file name.

If you do not specify a value, the function returns the path to the branding directory.

Any valid filename.local.css
needfileBoolean

Whether to return the /unprotected/broken.gif image () with a failure message when the requested file does not exist.

This parameter defaults to 0.

  • 1 — Return nothing.
  • 0 — Return the image and a failure message.
0
skipdefaultBoolean

Whether to ignore the default theme.

This parameter defaults to 0. 

  • 1 — Ignore the theme default.
  • 0 — Do not ignore the theme default.
0
checkmainBoolean

Whether the function should search the account's /cpanelbranding directory.

This parameter defaults to 0. 

  • 1 — Search the directory.
  • 0 — Do not search the directory.
1
nomagicBooleanWhether to include the

cPanel_magic_revision_########## prefix in the uri file path.

This parameter defaults to 0. 

  • 1 — Do not include the prefix.
  • 0 — Include the prefix.
0

Returns

ReturnTypeDescriptionPossible valuesExample
typestringThe file type.cphtml
pathstringThe path to the file.
  • The absolute path to the branding directory, if you did not specify a file value.
  • A valid absolute path and filename, if the file parameter's file exists.
  • An empty value, if the file does not exist and the needfile value is 1.
  • /unprotected/broken.gif, if the file does not exist and the needfile value is 0.

Note:

If you use the Paper Lantern theme, the file exists in the usr/local/cpanel/base/frontend/paper_lantern directory.

 Click to view...
/usr/local/cpanel/base/frontend/paper_lantern/branding/local.css
uristringThe relative path to the file.A valid path and filename, relative to the base directory.
 Click to view...
/cPanel_magic_revision_1327526145/frontend/paper_lantern/branding/local.css