Home  Extras  MODx Add-Ons  GetChunkByUPID

GetChunkByUPID



Forums Support Thread Votes: 19
Tags: Navigation, Menu, Style, snippet
Submitted: Jun 30, 2006
Released: Jun 30, 2006
Downloads: 1068
License: Public Domain


GetChunkByUPID 0.2 | Author: Dimmy

Works with the following Version(s): 0.9.0 | 0.9.1 | 0.9.2 | 0.9.2.1

GetChunkByUPID - MODx snippet (Get Chunk by UltimateParent ID)

This snippet recursively searches the document tree and determines the "ultimate" parent (the one whose parent is 0) of the given document, then ads that ID to a chunk name. it will then give you a chunk call corresponding to the id.


Download


Description

I was struggling with the fact that the parser can not pars a snippet insite a chunk call, e.g. {{chunkname-!snippetname!}}.
You may ask why would you want to do somthing like that? Here is why:

I often make multilangual sites and to show the visitor on what language he is I use flags those flags also have a link to the other languages.
so using a snippet like UltimateParent inste a chunk call would give me the option to get ID specific chunk calls but calling a snippetcall insite a chunkcall does not work. (atleast not on modx0.9.1.2 and before) Now I'v adapted Susan's great snippet (UlimateParent) to ouput a chunk call based on the UltimateParent ID.

this way you can display chunks that correspond to UltimateParents ID without using a TV and @INHERIT

Instructions

Just call the snippet like this:
!GetChunkByUPID? &chunk=`chunkprefix-`!
and create the coresponding chunks e.g. chunkprefix-12

when you do not set the $chunk in the snippet call or in the snippet itself it will return a chunkname that only contains a ID e.g. {{12}}




Sub-Packages


Forums Support Thread Votes: 17
Tags:
Submitted: Aug 15, 2008
Released: Aug 15, 2008
Downloads: 160
License: Free


GetChunkByUPField | Author: Sedgar

GetChunkByUPField - MODx snippet (Get Chunk by UltimateParent ID)

It will give you a chunk call corresponding to the found field e.g. if $chunk is "flags-%s" and the $field set to 'id' that is found is "12" it will give you a chunk call : {{flags-12}} this way you can display chunks that correspond to UltimateParents ID without using a TV and @inherit



Previous Releases



Comments

Please login to comment.

Close ]


 
 
 

Contact Us | Team Blog | FAQ | Site Credits

© 2005-2009 the MODx CMS project. All rights reserved. Privacy Policy | Terms of Service