Is there any way that inside partialLoop you can get a reference to the view
instance?

The issue is, I want to display a set of rows, and for each of those, some
data from its child rows. The solution I have been using is, essentially,
fetch the parents into an array of stdClass objects, then fetch the children
into an array whose keys are parent_ids and the values are arrays of
stdClass objects, then assign both to the view. In the view, as we iterate
through the parents, if array_key_exists($parentRow->id, $children) then we
print. Works fine in a view or a partial. However, the variable that is
accessible inside the view as $this->children is outside the scope of the
partialLoop -- right?

I suppose one option is to forgo partialLoop and do it all in a partial.

Another is to loop through the paginator items (in the model perhaps) and to
each assign the child data as a property, then pass the model thus beefed up
to the partialLoop. The thing that irks me about this is the redundant
looping, once to assign data and again to display it.

I hope this is clear. Any suggestions?

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness

Reply via email to