Tuesday 03 August 2004 7:45:34 pm
Okay, so I have a seemingly simple problem that I have spent the last 4 hours trying in vain to find a solution for. I have a series of objects in one folder, that each have an integer attribute , that I want to graph. Basically, each object is going to be a data point on one graph. Now, I successfully wrote a quick templet operator that takes an array from a template, and passes it on to a JP Graph script, which generate the graph as a png file, and sends its address back to the templet. so I thought the hard part was done! The problem I am having is getting ez publish to grab just this one attribute from each object, and put it into one simple array. I thought there should be two ways to do this: one, some variant of the fetch function, that does not fetch the entire node but just the content I specify for each node, or two, a section loop construct that loops through each object and appends the necessary data onto one array. The fetch function seems like the simple way to go here, but I can't find any documentation on how to do this, so I tried the section/loop construct idea. After searching through the documentation, this is the best I could come up with, but it still does not work.
{let myvar=array()}
{section name=polldata loop=fetch('content','list',hash(parent_node_id,$node.node_id,sort_by,$node.sort_array))}
{let kd=$polldata:item.data_map.polloutcome.content myvar=$myvar|append($kd)}
{set-block scope=root variable=myvar}{$polldata:myvar}{/set-block}
{/let}
{/section}
{jpgraph('test1', $myvar, 2) }
{/let}
The problem is that $myvar is still empty, even after is has gone through the loop and should be full of values. Any suggestions on how to improve the code above, or use a fetch function to implement the desired functionality would be greatly appreciated... :-)
-Nathaniel http://politicalretort.org/
|