Downloads » Resources » getField

getField

  • Currently 4.2941176470588/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Votes: 17

getField 1.3 beta

by grad

# 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.

Works with MODx Version(s): 0.9.5, 0.9.2.2, 0.9.2.1
Submitted: Nov 17th 2006 | License: LGPL | Downloads: 2490

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.

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

Previous Releases

getField 1.2.2

by grad

# 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

Works with MODx Version(s): 0.9.2.1
Submitted: Jul 18th 2006 | License: LGPL | Downloads: 1517

getField 1.1.1

by grad

# 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

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

getField 1.0

by grad

Initial Release

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


Extras

No results found.


( back to top )