Home

Possible to assign multiple components to the same region?

You are here

4 posts / 0 new
Last post
Possible to assign multiple components to the same region?

Hi.

I am new to Surf and the problem stated might be the expected and correct behavior, but for me it is unexpected. So I need some confirmation of my observations as I can't find any documentation on the subject. Is it not possible to assign multiple components to the same region on a page?

I.E


main
/static-modules/services
page


main
/tabbed-navigation-interface/highlights
page

The rendering process seem only to render the last of registered components in the main-region, which is kind of odd and not very flexible. I'd expect them to be rendered sequentially in the order they are registered.

Grateful for any feedback on this matter.

Re: Possible to assign multiple components to the same regio

Hi,

Unfortunately it's not possible to bind more than one Component to a Region in Spring Surf as there is a direct 1-1 mapping. The version of Spring Surf that you will have bundled with Alfresco 3.4.d does not provide any alternatives, however in the version that will be included with Alfresco 4.0 we have introduced the concept of Sub-Components to solve this problem.

I appreciate that this is not much help to you now, but in the future you will be able to create an Extension Module that extends a Component to add, remove and modify Sub-Components (see http://blogs.alfresco.com/wp/ddraper/2011/07/22/how-to-add-content-to-an-alfresco-share-page/).

A Surf Component is uniquely identified by the combination of the region-id, source-id and scope (which is why it's not possible to bind multiple Components to a single Region). In the Component configuration you've included Surf has created a Component object using the region-id, source-id and scope and then immediately overridden it with the second Component definition (because it has the *same* region-id, source-id and scope).... this is why you're only seeing the last Component (because in Surf terms there is only one).

If you provide some more information on what you're attempting to achieve then I will hopefully be able to help you workaround the problem for v3.4.d

Regards,
Dave

Re: Possible to assign multiple components to the same regio

Thanks for your reply. It was really helpful.

What I'm essentially trying to achieve is to keep the template structure really simple as well as flexible:

<#include "/common/layout.ftl"/>
<@layout>



<@region id="main" scope="page"/>


<@region id="contextual" scope="page"/>


All my website's pages are in a two column configuration, with a region "main" and a region "contextual" representing each column. The only difference between pages is that each page registers a different set of components to either the main or contextual region. But not being able to put several components into one region ruins this approach. As of now I guess I have to define main_1, main_2, main_3 and so on in order to have large enough set of regions to work with.

Re: Possible to assign multiple components to the same regio

This is exactly how the user and site dashboards have been implemented in Alfresco Share. Depending upon the layout you select there will be varying "grids" of regions and many won't be populated (this is why it's only possible to add 5 dashlets per column in a dashboard). If a region is "unbounded" you will still see it in the page source as an empty element.

This is a limitation of the older versions of Spring Surf but things have definitely improved in the latest version and we're continuing to make this better and easier to do layouts.

Regards,
Dave