.

Copyright, 2009, by Brandon Booth. All rights reserved. Permission is granted to make copies of this spreadsheet for private use only.

.

Please visit my website at:www.lucidgreen.net

.

PLEASE NOTE:This document applies to Modx 0.9.6. More documentation can be found at the following links:

.

Official Docs:http://svn.modxcms.com/docs/display/MODx096/Home

.

Wiki:http://wiki.modxcms.com/index.php/Main_Page

.

Site Settings Tags

.

These may be used in templates, documents, snippets, chunks and in snippet calls (e.g. [[Wayfinder? &startID=`[(site_start)]`]]

.

[(site_start)]Document ID of the site's starting page

.

[(site_url)]the url to the site: http://www.mysite.com/modx

.

[(base_url)]sites relative base url i.e. /modx/

.

.

Template Variables

.

Template Variables (aka TVs) can be used in templates, and directly in documents. They can also be called within snippets and chunks

.

Built in "Document Specific Resources"http://svn.modxcms.com/docs/display/MODx096/Document-Specific+Resource+Fields

.

[*pagetitle*]Page title from manager

.

[*longtitle*]Long title from manager

.

[*description*]Description form manager

.

[*introtext*]Intro text from manager

.

[*#content*]Document content, the # allows this variable to edited with Quickedit.

.

[*parent*]ID of parent document (e.g. link to parent document with: [~[*parent*]~])

.

[*id*]current page's id

.

[*type*]Whether document, folder or weblink

.

[*alias*]document alias

.

[*link_attributes - The Link Attributes of the page, eg. rel=, target= etc.

.

[*published - [0|1] Whether or not the document is published.

.

[*pub_date- Date the document is to be published. This is not a "normal" date, and must be processed by a script for meaningful output.

.

[*unpub_date - Date the document is to be unpublished. See 'pub_date'.

.

[*parent- The ID of the document's parent.

.

[*isfolder- [0|1] Whether or not the document is a folder.

.

[*richtext - [0|1] Whether or not a RichText Editor is to be used when editing the document.

.

[*template - The ID of the template to used for the document.

.

[*menuindex - The order in which the document is to be listed in the menu.

.

[*searchable - [0|1] Whether or not the document is to be searchable.

.

[*cacheable - [0|1] Whether or not the document is to be cached.

.

[*createdby - The user ID of the creator of the document.

.

[*createdon - The date the document was created. See pub_date.

.

[*editedby - The ID of the user who last edited the document.

.

[*editedon - The date the document was last edited. See pub_date.

.

[*deleted - [0|1] Whether or not the document has been deleted (but not yet completely removed from the database by emptying the trash).

.

[*deletedon - The date the document was deleted. See pub_date.

.

# deletedby - The ID of the user who deleted the document.

.

# menutitle - The title to be shown in the menu. If empty, the pagetitle is used.

.

# donthit - [0|1] Disable page hit count for the document.

.

# haskeywords - [0|1] Whether or not the document has links to keywords.

.

# hasmetatags - [0|1] Whether or not the document has links to meta tags

.

# privateweb - [0|1] Whether or not this document has been assigned to a private web document group.

.

# privatemgr - [0|1] Whether or not this document has been assigned to a private manager document group.

.

# content_dispo - [0|1] Whether the document's content-disposition is attachment or inline.

.

# hidemenu - [0|1] Whether or not the document is to be hidden in the menu.

.

.

.

Custom template variables

.

[*custom name*]Any custom template variable

.

$TVarray = $modx->getTemplateVarOutput(array('TV NAME')); Calling TVs in a snippet

The content of the TV is now in the array $TVarray['TV NAME'] by character. (e.g. $TVarray['TV NAME'][1] is the second character in the string.
http://wiki.modxcms.com/index.php/Adding_TV_Widgets_without_hacking_the_core

.

@BINDINGSData Sources can be tied (or “bound”) to a Template Variable for formatting and displaying in document. these can be used to fill a template variable (even a default value) with external data, other documents from the document tree, etc.

.

@DIRECTORY path_to_folderBinds the variable to a folder, where path_to_folder_ is the path to the folder. It returns the list of files in the specified folder.

.

@INHERITdefault content cascades from parent document's tv.

This binding takes advantage of the hierarchical structure of the document tree by allowing Template Variable content to "cascade" down the document tree. What this means is that you can apply content to whole sections of your site by editing just one TV.

.

@FILE file_pathBinds the variable to a file, where file_path is the path and name of the file. The return value is a string containing the content of the file. The file path is the abosulte path from the root of the server or your particular installation.

.

@DOCUMENT document_idBinds the variable to a document. Where document_id is the numeric id of the document. The returned value is a string containing the content of the document.

.

@CHUNK chunk_nameBinds the variable to a document. Where chunk_name is the name of the chunk. The returned value is a string containing the content of the chunk.

.

@SELECT sql_statementBinds the variable to a database query that returns a recordset. Where sql_query is the actual database query. The return value is a recordset.

.

@EVAL php_codeEvaluates a string of php codes and process the returned value from the code. Where php_code is the actual php code to be evaluated. The returned value can be either a string, array or a recordset.

.

.

Snippets

.

[[snippetname]]Cached format (output only updated when page is re-cached)

.

[!snippetname!]Uncached format (output is updated on every page call)

.

[[snippet? &settingVariable=`value`]]A snippet call with a setting variable.

.

$modx->runSnippet( snippetName, array($params));Calling a snippet in code for another snippet or module

EXAMPLE:
$dittoOutput = $modx->runSnippet(
"Ditto",
array(
"tpl" => "<post><title>[+title+]</title><summary>[+summary+]</summary></post>"
)
);
see: http://wiki.modxcms.com/index.php/API:runSnippet

.

.

Chunks

.

Chunks can contain basic text, HTML, or template data for snippets. They cannot contain PHP code, but they can contain calls to snippets

.

{{chunkname}}Basic format

.

$modx->getChunk('chunkName'); $modx->putChunk('chunkName'); manipulate chunks with API in snippet

.

.

.

links

.

[~#~]links to document whose ID = #, e.g. [~3~]