Downloads » Resources » getField » getField | 1.1.1

getField 1.1.1

  • Currently 4.2941176470588/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
17 vote(s).

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.

Works with MODx Version(s): 0.9.2.1
Submitted: Jul 13th 2006 | License: LGPL | Downloads: 678
This resource has been deprecated.

Description

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.

Uses idea of getDoc by Mark with modification from luke.stokes

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


( back to top )