On 14 Feb 2009, at 16:01, David Zülke wrote:
> So, there's our problem. Simple solution: you *forward* (not  
> redirect) internally to the ViewComment action, and change the  
> output type. Also, you force the request method to "read", just  
> because it feels better:
>
> return $this->createForwardContainer('Module', 'ViewComment',  
> array('id' => $commentId), 'html', 'read');


This looks as though this would only return the HTML of the comment.  
However, I would like the html within a JSON object (say as a 'html'  
variable). I've read in another thread that I should have a layout  
with a content layer, and a decorator that just echos a call to  
json_encode:

echo json_encode(array_merge($t['data'], array('html' => $inner)));

To set-up this layout, I have essentially just copied the html layout  
(from the tutorial) from the html output type to the json output type  
in output_types.xml (but with no slots, and I have changed the  
decorator file to' jsonDecorator': the name of my decorator template  
file).

However I suspect that I have not setup the layout properly. In  
executeJson I call

$this->getLayer('content')->setTemplate('comment');

but I get the error:

Call to a member function setTemplate() on a non-object

So it looks like I don't have a layer 'content'. Can I ask how to  
properly setup this content layer?

Michal.



_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to