This article documents the usage of cPanel API2 tags in relation to the cPanel interface. These tags can be used in files in the /usr/local/cpanel/base/frontend/ docroot.
<?cp Module::function(%, def) output=output_list || 'message' ?>
API2 tags allow you to access functions within cPanel's core code. Using these functions, you can output information. API2 tags provide a way to access raw variables. An API2 tag will search for all instances of a variable and output all of them. For example, if you have 10 different branding packages, you would only need one API2 tag to output the information requested from every package.
<?cp Branding::showpkgs( % % ,pkg,previewimg ) ?>
The above API2 tag would output the name of all branding packages, and the URLs of their preview images.
<?cp Branding::showpkgs(i [tr] [td align=``center'']%[/td] [td align=``center''][a href=``%''][img src=``previewicon.jpg'' /][/a][/td] [/tr] ,pkg,previewimg) || '[tr][td colspan=``2'']$LANG{'NoPackages'}[/td][/tr]' ?>
The above API2 tag would output a table row containing 2 columns. The first column would hold the name of a branding package, the second would contain an imag which links to the location of the preview image for that package. If no branding packages were present, the tag would output a table row and column containing the NoPackages language tag.
When using API2 tags, other <cpanel> tags function different inside the API2 tag. Those tags and their modified usage are listed below:
Copyright 2007 cPanel Inc.