<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Oleg Pronin <syber.rus@gmail.com><br>To: catalyst@lists.rawmode.org<br>Sent: Wednesday, March 28, 2007 5:55:54 PM<br>Subject: [Catalyst] Componentised actions.<br><br><div>Greetings!</div>
<div> </div>
<div>I'm developing a website based on catalyst and want it to be moduled and componentised the way like this:</div>
<div> </div>
<div><a rel="nofollow" target="_blank" href="http://site.com/object1/list">site.com/object1/list</a> </div>
<div> displays objects 1 in empty design.</div>
<div> </div>
<div>
<div><a rel="nofollow" target="_blank" href="http://site.com/object2/list">site.com/object2/list</a> </div>
<div> displays objects 2 in empty design.</div>
<div> </div>
<div><a rel="nofollow" target="_blank" href="http://site.com/nicepage">site.com/nicepage</a></div>
<div> displays a page in website design which contains result of processing actions '<a rel="nofollow" target="_blank" href="http://site.com/object1/list">site.com/object1/list</a>' and '<a rel="nofollow" target="_blank" href="http://site.com/object2/list">site.com/object2/list
</a>'.</div>
<div> </div>
<div>The question one is how do i get the output of the actions inserted into another template ?</div>
<div> </div>
<div>i mean something like </div>
<div> </div>
<div>page template page template</div>
<div>[% c.forward('/object1/list') %]</div>
<div>page template page template, </div>
<div> </div>
<div>just for example, this of course doesn't work.</div>
<div> </div>
<div> </div>
<div>The question two is how do i know while running in '/object2/list' action </div>
<div>whether action is called from the browser or inserted into another template.</div>
<div> </div>
<div>I.e. i want URL <a rel="nofollow" target="_blank" href="http://site.com/object1/list">site.com/object1/list</a> to display information in site design while the same action inserted into another template</div>
<div>( pseudo :) [% c.forward('/object1/list') %] ) to display information in empty desing (i.e. through another VIEW).</div>
<div> </div>
<div>Any suggestions ?</div>
<div> </div>
<div>Best regards, Pronin Oleg, Rambler Internet Holding.<br><br>Let me see if I understand what you are trying to do. You want a portal like system where you have a parent page that contains units or regions that automatically dispatch to different actions and perform a full request cycle, including returning a response body suitable for including in the parent page. If so that sounds like something I was trying to do earlier this year. There is a Catalyst subrequest plugin (both in CPAN and a newer, unreleased version in the source control repository) which could in theory be used to make portal like applications. However I wasn't able to get this to perform satisfactorily since the CPAN plugin has known limitations in terms of it's ability to properly scope stuff and I couldn't get the repository version to work at all (although might just be my ignorance, your results may vary)<br><br>There is a branch in the repo that is supposedly to make this
kind of this easier (or at least that was my understanding of it) called "app_context_split" (at least that is what I think it was called) but the repo doesn't show any work on that since January and since I don't know about the goal of that branch or the outstanding TODO list I'm not sure what to say about it. Maybe the author can speak up?<br><br>You could write a custom action class or something to do a cold, hard LWP http request. I tried that but found the performance to be bad and there was a lot of trouble to make sure everything work right such as if the parent page gets a POST what does your 'portlet' (for lack of a better work) get? Does it get a post with all the posted params and posted attachments? Get's very expensive and there's a lot of plumbing to do.<br><br>In the end I gave up trying to make my application this way since I couldn't find an elegant way to do it that didn't require a lot of plumbing work on my part and also
performed well. The direction I took was to 'componentize' my page using TT's ability to include bits of other templates. That way I have something like what I want, but I admit it isn't so perfect since I have more coupling between logic and presentation than is usually considered good practice.<br><br>Why not tell us a little more about what your application is trying to do and we can maybe advice a way around this problem.<br><br>--John<br><br></div></div></div><br></div></div><br>
<hr size=1>Don't be flakey. <a href="http://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mail">Get Yahoo! Mail for Mobile</a> and <br><a href="http://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mail">always stay connected</a> to friends.</body></html>