getField
Votes: 35
Tags: Navigation, Menu, snippet, document, field, parent
Submitted: Nov 17, 2006
Released: Nov 17, 2006
Downloads: 3376
License: LGPL
getField 1.3 beta
Works with the following Version(s): 0.9.2.1 | 0.9.2.2 | 0.9.5
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.
Download
- repo-1189.zip (3376 downloads)
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.
Sub-Packages
Previous Releases
1.2.2
Votes: 28
Tags: Navigation, Menu, snippet, document, field, parent
Submitted: Jul 18, 2006
Released: Jul 18, 2006
Downloads: 1708
License: LGPL
getField 1.2.2
Works with the following Version(s): 0.9.2.1
Returns any field or template variable from any document or any of its parents.
Download
- repo-764.txt (1708 downloads)
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
# Document for which to get a field.
# Default: current document
# $field string
# Field to get for the document:
# - any of the document object fields
# (http://modxcms.com/the-document-object.html)
# - template variable assigned to the document
# Default: 'pagetitle'
# $parent 0 | 1
# $parent = 1 - returns the field for the parent of the document.
# Default: 0
# $parentLevel int
# 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.
# Default: 0
Updates# 1.2.2
- a quick fix to "Cannot redeclare function"
# 1.2.1
- reworked fetching of template variable to enable output of widget
# 1.2
- reworked fetching of template variable value to get INHERITED value
- removed defaulting to 'pagetitle' when $field not found; this is due to fact that tv can have empty value
1.1.1
Votes: 27
Tags: Navigation, Menu, snippet, document, field, parent
Submitted: Jul 13, 2006
Released: Jul 13, 2006
Downloads: 755
License: LGPL
getField 1.1.1
Works with the following Version(s): 0.9.2.1
This version has been marked as deprecated. Please use a newer version.
Gets a field or template variable for current or specified document or its parent up to specified number of levels untill ultimate parent is reached.
Download
- repo-714.txt (755 downloads)
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
# Document for which to get a field.
# Default: current document
# $field string
# Field to get for the document:
# - any of the document object fields
# (http://modxcms.com/the-document-object.html)
# - template variable assigned to the document
# Default: 'pagetitle'
# $parent 0 | 1
# $parent = 1 - returns the field for the parent of the document.
# Default: 0
# $parentLevel int
# 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.
# Default: 0
Updates# 1.1.1
- fixed $parentLevel and $topid
# 1.1
- reworked fetching of template variable value, now it gets computed value instead of nominal; however, still not the inherited value
- changed license to LGPL
1.0
Votes: 28
Tags: Navigation, Menu, snippet, document, field, parent
Submitted: Jul 7, 2006
Released: Jul 7, 2006
Downloads: 690
License: LGPL
getField 1.0
Works with the following Version(s): 0.9.2.1
This version has been marked as deprecated. Please use a newer version.
Gets a field or template variable for current or specified document or its parent up to specified number of levels untill ultimate parent is reached.
Download
- repo-669.txt (690 downloads)
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
# Document for which to get a field.
# Default: current document
# $field string
# Field to get for the document:
# - any of the document object fields
# (http://modxcms.com/the-document-object.html)
# - template variable assigned to the document
# Default: 'pagetitle'
# $parent 0 | 1
# $parent = 1 - returns the field for the parent of the document.
# Default: 0
# $parentLevel int
# 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.
# Default: 0
Updates# 1.0
- first public release

Please login to comment.