Understanding the MODx Document Object


The Document Object allows you to easily insert variables into every page on your website such as the title, longtitle, alias and more.

Usage:

$modx->documentObject['objectName'];

Commonly Used Document Strings

The are frequently used in page templates in building sites.

alias
Returns string of document alias – limited to 100 characters
id
Returns the integer id for the page
description
Returns string of description – limited to 255 characters
introtext
Returns the Summary field of the document
longtitle
Returns string of document long title – limited to 255 characters
menutitle
Returns the string of the menu title in the page.
pagetitle
Returns string of page title – limited to 100 characters

Useful for Custom Menus

They are frequently used in menu building snippets, such as the default DropMenu.

alias
Returns string of document alias – limited to 100 characters
id
Returns the integer id for the page
description
Returns string of description – limited to 255 characters
isfolder
Integer; true (1) if the document is a folder and false (0) if it is not.
longtitle
Longtitle string of page.
longtitle
Returns string of document long title – limited to 255 characters
menuindex
Returns the menu index (sort order) ingeger as set during content creation/edit.
menutitle
Returns the string of the menu title in the page.
pagetitle
Returns string of page title – limited to 100 characters
parent
The integer of the parent
hidemenu
Returns 1 (true) or 0 (false) to designate whether this item will show in the menu or not.
type
Returns a string of either 'document' for pages or 'reference' for links

All Document Objects

The following is a complete list of all MODx Document Objects.

id
Returns the integer id for the page
type
Returns string either 'document' for pages or 'reference' for links
contentType
Returns string of content type specified in manager Content Type drop down menu.
pagetitle
Returns string of page title – limited to 100 characters
longtitle
Returns string of document long title – limited to 255 characters
description
Returns string of description – limited to 255 characters
alias
Returns string of document alias – limited to 100 characters
published
Returns integer declaring publish status (0=no, 1=yes)
pub_date
Returns date document begins viewability (in seconds since January 1, 1970). Note- when this is set, ['published'] is automatically set to true (1)
unpub_date
Returns date document ends viewability (in seconds since January 1, 1970). Note- setting this will NOT have any effect on the status of the ['published'] setting.
parent
The integer of the parent
isfolder
Integer; true (1) if the document is a folder and false (0) if it is not.
introtext
Returns the Summary field of the document
content
Returns string of all your content of the document. This is generally the HTML code produced in the WYSIWYG tool in the content manager.
richtext
Returns true (1) or false (0), used to specify if a rich text editor should be used in the manager.
template
Returns the integer template id to be used with this content.
menuindex
Returns the menu index (sort order) ingeger as set during content creation/edit.
menutitle
Returns the string of the menu title in the page.
searchable
Returns 1 (true) or 0 (false) to designate whether this page content should be searchable.
cacheable
Returns 1 (true) or 0 (false) if this page should be cached. This is set to false by default so dynamic snippets function properly.
createdby
Returns integer id number of user who created content.
createdon
Returns date (in seconds since January 1, 1970) of when the content was create.
editedby
Returns integer id number of the user who last edited the content.
editedon
Returns date of the last edit (in seconds since January 1, 1970).
deleted
Returns 1 (true) or 0 (false). When true, this document will appear in the recyling bin until the recycling bin gets emptied. At that point, the record is removed entirely from the database (REALLY deleted).
deletedon
Returns date of document deletion (in seconds since January 1, 1970).
deletedby
Returns the integer id of the person who deleted the document.
donthit
True (1) or False (0) to indicate whether or not the page registers in the site statics/user tracking.
haskeyword
True (1) or False (0) to indicate if the document has keywords assignded to it or not.
hasmetatag
True (1) or False (0) to indicate if the document has metatags assigned to it or not.
privateweb
True (1) or False (0) to indicate if the document is private for Web Users or not.
privatemgr
True (1) or False (0) to indicate if the document is private for Manager users or not.
content_dispo
Returns a string of 'inline' or 'attachment'. Inline documents are displayed in web browsers. Attachment disposition causes the document to be downloaded to the local machine through the web browser file download dialog box.
hidemenu
Returns 1 (true) or 0 (false) to designate whether this item will show in the menu or not.