opengeek / getResources

A MODx Snippet for iterating a collection of MODx Resources
http://rtfm.modx.com/display/ADDON/getResources
27 stars 22 forks source link

Feature request: define tpl based on parent #69

Closed oksushi closed 12 years ago

oksushi commented 12 years ago

It would be useful to be able to specify a different tpl to use base on the source parent. This could work similar to tplN, perhaps along the lines of tplParent1=``, where Parent1 is the first ID declared in the parent snippet call attributes.

This would eliminate the need to use conditional filters in a tpl chunk when trying to use different HTML based on the parent.

opengeek commented 12 years ago

I think the conditional templates feature provided by @freejung as pull request #58 should meet this requirement. I will work on integrating that capability soon.

freejung commented 12 years ago

Yes, this is exactly the sort of thing I had in mind. The call would look like:

[[getResources? &tplCondition = parent &conditionalTpls = {"1":"parent1Tpl", "2":"parent2Tpl", "3":"parent3Tpl"} &tpl = defaultTpl]]

Where the numbers in the JSON array are the ID numbers of your parent resources.