Skip to content

Instantly share code, notes, and snippets.

@keif
Forked from larscwallin/Disclaimer.chunk
Created January 13, 2012 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keif/1608947 to your computer and use it in GitHub Desktop.
Save keif/1608947 to your computer and use it in GitHub Desktop.
Widgeteer IRXML
I had thought something similar, but we're still hitting the same issue.
Disclaimers.chunk highlights a simple case (without delving three levels deep :) )
It executes and successfully retrieves the first value, but fails on the second. In this example, it retrieves PubDate successfully, fails to retrieve PubTime - if we swap the values around, it finds PubTime and fails to find PubDate.
I don't see the array being manipulated in the code to where it should suddenly "lose its place" but I'm going to try throwing in a few more debug statements.
Once I've got this issue wrapped up I want to see about getting cacheing enabled (I'm pretty much throwing myself in to MODX - thanks for all your help!
-kb
////////////
Hi :)
Here comes an untested, but probable, solution.
From reading your log I think i saw your the root of your issue. It would seem that you placed many identical placeholders in a sequence to iterate through the collection of Dislamer items. Widgeteer only iterates using separate templates however. A good rule is that as soon as you see a {} in your feed and you want something other than a simple string or number value you need a new chunk template. Every template is an iteration point. No chunk, no iteration.
You basically have have three levels you want to traverse
- IRXML
-- Disclaimers
--- Disclaimer
For each of these levels you create a chunk template. Every Disclaimer object is just a collection of attributes and a string field called DisclaimerText. At this point you can access any Simple field from a nested object (like the attributes) and of course any local field such as the DisclaimerText.
If lets say the @attributes object had a collection you wished to iterate through you would need yet another chunk.
Hope this works for you. Again i have not tested it so there might be mistakes :)
Good luck!
<h4> [[+Disclaimers.@attributes.PubDate]]:[[+Disclaimers.@attributes.PubTime]] </h4>
<h2> [[+IRXML.@attributes.CorpMasterID]]</h2>
[[+Disclaimers]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment