PageAPI Tool documentation for the dotCMS Content Management System

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.

The following example shows how the PageAPI Tool is mapped in the toolbox-xml file:

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

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

Determine if any content has been added to a page {#ExampleCheckContent}

References

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