[Catalyst] RFC and first draft for page regions

Dami Laurent (PJ) laurent.dami at justice.ge.ch
Mon Oct 16 14:37:45 CEST 2006


> John Napiorkowski
> Envoyé : jeudi, 12. octobre 2006 19:51

> In the past several people have talked about the idea of 
> augmenting catalyst so that you could associate actions as 
> subarea or regions of a controlling action.
>  This would make it easier to break up a page for the 
> purposes of making portal like websites and for easing work 
> to make AJAX style content areas in a page.
> 
> I've made a first stab at that with the attached code.
 ....
> Anyway I don't know if anyone has comments or thoughts on the 
> code. 
Hi John,

Maybe I'm missing something, but I don't see the necessity for a plugin or any other Catalyst extension for doing page regions. 

As far as I understand, a "region" is a piece of content, produced by an action; so usual Catalyst mechanisms should do the work. Now the question is where page assembly takes place. 

If the assembly is client-side, using Ajax or iframes or both, then the server doesn't even have to know about it. Well, there might actually some needs to differentiate the rendering when a region is displayed within a page or displayed on its own (think of preamble/postamble things like headers, footers, styles or script code); but this can be easily sorted out with an additional parameter to the region action.

If the assembly is server-side, then it depends on where the regions come from. If regions come from remote sites, then the server has to grab them through LWP, as you propose. But if the regions come from the same Catalyst application, then it is far better to directly call the corresponding actions (forward, subrequest, or direct method call), gathering their output (use the TT view "render" method), and then passing the fragments to a page view for putting them together.

One more remark : usually the purpose of a portal-like application is that the users can decide for themselves which regions will belong to a page, and store that configuration in user-specific preferences. This means that the regions are not known statically, and therefore it is not possible to decorate the page action with region attributes within the code. Rather, the page action has to go to some persistent storage, find out which regions it should call, then call them and gather the contents.

Best regards, Laurent Dami



More information about the Catalyst mailing list