setPlaceholders

setplaceholders

  • By jgrant
  • Latest release March 26, 2014 (12 years ago)

About

setPlaceholders combines the usefulness of placeholders—which are rather like local variables—with a fast and versatile engine for gathering up data from resources. It provides a set of selectors for full traversal of the resource tree (parents, siblings, and children; absolute and relative positions) and easy retrieval of any field or TV, then puts these or any other data into placeholders for convenient use throughout a template or chunk.

It blends the functionality of getResourceField, UltimateParent, getUrlParam plus much more into one very optimized snippet.

More on GitHub.

Installation & usage

Download and install.  The package contains one snippet called setPlaceholders.  It's that easy.

At a glance

MODX 3 compatibility unknown. Based on our testing and community reports where available.

  • Developer jgrant
  • Latest release March 26, 2014 (12 years ago)
  • First seen in SiteDash March 26, 2014 (12 years ago)
  • License GPLv2
  • MODX support 2.0 – 100.0

Releases 1 indexed release

Changelog
MODX.com

2.2.1-pl

March 26, 2014

12 years ago

<p><b>2.2.1-pl </b>[25.03.2014]</p><ul><li>Add short convenience aliases for setPlaceholders snippet: sph and spho (with &amp;output=`1`)</li></ul><p><b>2.2.0-pl</b></p><ul><li>Add the ability to process more than one fallback/default value</li><li>Add a request selector for stuff from the $_REQUEST superglobal</li><li>Add parents and parentsI selectors for returning a list of parent IDs from the ultimate parent down to the resource</li><li>Add bounded versions of the parent and Uparent selectors</li></ul><p><b>2.1.0-pl</b></p><ul><li>[<a href="https://github.com/oo12/setPlaceholders/issues/2" title="" rel="nofollow noreferrer noopener" target="_blank">#2</a>] Add the ability to chain child selectors. Ex: child-1.child2.pagetitle (pagetitle of the 2nd child of the current resource's last child)</li><li>add a migxR/jsonR selector to get a random item from a MIGX TV.</li></ul><p><b>2.0.1-pl</b></p><ul><li>fixes a bug with the parent selector</li></ul><p><b>2.0.0-pl</b></p><ul><li>~3x faster TV handling, now doesn't process them by default</li><li>adds next/prev sibling selectors. next2 selects the sibling after next, etc.</li><li>adds a "random child" selector, plus simple ways of retrieving the number of children or parents a resource has, a resource's position amongst its siblings, or the number of items a MIGX TV contains.</li><li>memory usage improvements</li></ul><p><b>N O T E   T H E S E   C H A N G E S:</b></p><ul><li>Removes &amp;fields property (deprecated since v1.1)</li><li>Now does not process TVs by default. Use &amp;processTVs=`1` if you need to process them.</li><li>Removes output filter functionality. Use the built-in output filter toPlaceholder instead. It works exactly the same.</li><li>If you specify an index on the parent, Uparent, child, next or prev selector which is out of bounds, setPlaceholders now returns an empty string, which makes specifying a default value easier.</li></ul><p>  </p><p><b>1.2.1-pl</b></p><ul><li>Improves child selector performance</li><li>Changes behavior when a value isn't found for a placeholder: now the placeholder will be set to an empty string so MODX will fully parse and cache it.</li><li>A few other minor fixes and improvements</li></ul><p><b>1.2.0-pl</b></p><ul><li>Adds a child resource selector. Ex: child4.pagetitle (4th child) or child-1.pagetitle (last child)</li><li>Adds optional special processing for MIGX TVs (arrays of JSON objects).  For example, parent.migx.someMIGXtv will set a placeholder for each key/value pair in the TV.</li><li>Minor performance improvements</li></ul><p><b>1.1.0-pl</b></p><ul><li>Added &amp;ph property with a more powerful syntax.  It adds: "Ultimate parent" functionality, the ability to specify different resource IDs, optional user-defined placeholder names, and parsing of default values</li><li>&amp;fields is now deprecated, but retained for backwards compatibility</li><li>Performance and caching improvements</li><li>fix an issue that can generate PHP notices</li></ul>

We've also seen 1 unverified version of setPlaceholders in use, but don't list those as we've been unable of confirming they are official releases from an official source.