PageAPI Tool - Documentation topics on: htmlpageapi,.

PageAPI Tool

The PageAPI Tool Velocity viewtool provides methods to check the status and permissions of pages, and load page references (objects or identifiers) for specific pages.

Usage

Methods

MethodReturn
Value
Description
$pageAPI.canUserPublish(pageId, true)BooleanReturns true if the current user has permissions to publish the page with the specified pageId.
Note: The second parameter is a boolean value that must be passed for backward compatibility, but does not affect the operation of the method.
$pageAPI.hasContent(page, container)BooleanReturns true if content has been added to the specified container on the specified page.
$pageAPI.loadPageByPath(path, host)HTMLPageReturns the HTMLPage object for the page specified by the path and host.
$pageAPI.loadPageIdentifier(path, host)StringReturns the Identifier of the page specified by the path and host.

Parameters

ParameterTypeDefaultDescription
pageIdStringRequiredThe identifier or inode of a page (returned either by the loadPageIdentifier() method or via other Velocity code).
pageHTMLPage objectRequiredAn object representing a page (returned either by the loadPageByPath() method or via other Velocity code).
containerContainer objectRequiredAn object representing a container (returned via other Velocity code).
pathStringRequiredA path in the dotCMS folder structure.
hostStringRequiredThe name of a dotCMS Host.

Examples

Example: Determine if any content has been added to a page

Toolbox.xml Configuration

The Import Tool is enabled by default in dotCMS. To ensure the Import Tool is enabled, verify that the following lines exist in your toolbox.xml file:

<tool>
    <key>pageAPI</key>
    <scope>request</scope>
    <class>com.dotmarketing.viewtools.HTMLPageWebAPI</class>
</tool>

References

For more information on this viewtool, please see the following documentation in the dotCMS Javadocs: