Description
This function lists available templates for cPanel's Site Publisher feature.
- If you call this function as the
root
orsystem
user, the function lists theroot
user's templates. - If you call this function as a reseller, the function lists the
root
user's templates and the reseller's templates. - If you call this function as a cPanel user, the function's output depends on the account's owner:
- If the
root
user owns the account, the function only lists theroot
user's templates. - If a reseller owns the account, the function lists the
root
user's templates and that reseller's templates.
- If the
Note:
The template directory's location depends on whether the root
user or a reseller owns the template.
/var/cpanel/customizations/site_templates/
— Templates that theroot
user owns./home/username/var/cpanel/reseller/site_templates/
— Templates that a reseller owns, whereusername
represents the reseller's username./usr/local/cpanel/etc/site_templates/
— cPanel-provided templates.
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
This function does not accept parameters.
Returns
Return |
Type |
Description |
Possible values |
Example |
|
hash |
An unnamed hash of the authenticated user's available templates. |
This hash includes the name, preview, and path returns. |
|
name |
string |
The template's name. The function returns this value in the unnamed hash. |
The name of a directory that exists within the/var/cpanel/customizations/site_templates/ directory, the/var/cpanel/reseller/site_templates/ directory, or the/usr/local/cpanel/etc/site_templates/ directory, and which contains ameta.json template information file. Note: The template directory's location depends on whether the root user or a reseller owns the template. |
mytemplate |
preview |
Boolean |
Whether the template includes a preview image. The function returns this value in the unnamed hash. |
|
1 |
path |
string |
The template directory path. The function returns this value in the unnamed hash. |
A valid path. Note: The template directory's location depends on whether the root user or a reseller owns the template. |
|