Home  Extras  MODx Add-Ons  getField

Product:

getField


Forums Support Thread Votes: 198
Tags: Navigation, Menu, snippet, document, field, parent
Submitted: Nov 17, 2006
Released: Nov 17, 2006
Downloads: 5448
License: LGPL

Works with:
0.9.5
0.9.2.2
0.9.2.1

getField 1.3 beta | Author: grad

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


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.




Released Versions

Releases that are grayed out are deprecated.

Version Released Author Downloads
Total Versions: 4 Total Downloads: 8,945
1.3 beta Nov 17, 2006 grad 5,448
1.2.2 Jul 18, 2006 grad 1,933
1.1.1 Jul 13, 2006 grad 821
1.0 Jul 07, 2006 grad 743

Download Statistics

Package downloads per day since tracking began on June 27th, 2010. Weekends are colored. Plot below shows an overview.


Top Countries

This is a list of the countries most downloading this Extra.

Country Downloads
United States 90
Japan 53
Russian Federation 49
United Kingdom 32
Germany 28
Australia 12
Ukraine 10
France 8
Sweden 8
Austria 7
 
 
 

Contact Us | Advertise | Team Blog | FAQ | Credits

© 2005-2010 MODx, LLC. All rights reserved. Privacy Policy | Terms of Service