getField 1.3 beta
Returns any field or template variable from any document or any of its parents.
This is a beta release. Although it seems to work fine, please report any errors in the support thread.
Submitted: Nov 17th 2006 | License: LGPL | Downloads: 1948
Description
Returns any document field (id, pagetitle, alias, etc.) or any template variable for:
* any document
* any of its parents up to a specified number of levels (eg. 2 levels up)
* its ultimate parent (right under the document tree root)
Instructions
# $docid [ int ]
# ID of the document for which to get a field content.
# Default: current document
# $field [ string ]
# Name of the field for which to get the content:
# - any of the document object fields (http://modxcms.com/the-document-object.html)
# - template variable
# Default: 'pagetitle'
# $parent [ 0 | 1 ]
# If set to 1, the snippet will return value for the document parent.
# Default: 0
# $parentLevel [ int ]
# Specifies how high in the document tree to search for the parent of the document:
# - $parentLevel = 0 - returns the ultimate parent (right under site root)
# - $parentLevel = 1 - returns the direct parent
# Default: 0
# $topid [ int ]
# Id of the topmost document in the document tree under which to search for a parent. Used only with $parent set to 1.
# Default: 0
Updates
# 1.3
- Distribution package is compatible with MODx Resource Wizard.
- Applied MODx snippet coding guidlines from http://wiki.modxcms.com/index.php/Creating_Snippets.
- changed variables and function names
- variables get destroyed after use
- moved functions to the external include
- Created GetField.txt with history, links to documentation and repository and installation instructions.
- Changed field fetching routine to always use gfGetFieldContent function.
This is a beta release. Although it seems to work fine, please report any errors in the support thread.