share menu between espaces - how to do that ?

share menu between espaces - how to do that ?

I have a screen that can be used in two modules (espaces) and I would like to keep the menu from the application that is calling it. I am avoiding put this screen inside a block because the actions will be in the main content section instead of actions section. On the other hand, I will not copy this screen to put in another espace because I duplicate the code that I have to maintain.
Someone has some tip to solve this in an elegant way ?

Hi Luciano,

The typical way to solve common elements is to isolate them in a third module, and be referenced by the other 2 modules. In the specific case of the menu, you can do as explained before, with the difference that every entry in the menu will have to be created manually and should be external URLs to avoid circular an upward references.
You can read more about architecture in the following article in the knowledge base entitled The 4 Layer Canvas.

Let me know if this helps.

Hi Rúben,
   thanks for your tip.
   How can I create the menu manually ?  I looked in the general structure and I could realise the menuItem and menuSubitem data can be shared between espaces. The menu component (block) have the ActiveMenuItemId and ActiveSubMenuItemId parameters. If I could inject , through an if, the registers from other espace (menuItem and menuSubitem) I could solve this. The problem is that I don´t know how and where to put the code. Do you have any idea ?
Yes the entity Menu should be in the same module as the menu webblock, and be public.
This way the normal usage of the menu is kept. (the only difference is that you loose the scafolding in the menu and the links need to be external links.)
Hi Rúben,
   unfortunately I am stuck. I don´t know how to do that. Could you supply a template ?

Here's what I do.  

1) Create a menu in your primary espace
2) Create attributes to hold espace name and EntryName
3) On the link for the menu item create link it to an external URL and use the Entry and Espace name.  Make sure the Entry name is exactly as it is in the target espace.

4) Make sure your menu is public.

Hope this helps.

  I found a fastest and simplest way to solve this. I only put an if in the header and menu. I did reference to the other espace and put the new blocks in the else option. 
Enabling the menu option you need to follow the same procedure referencing the menuItem and menuSubItem from the other espace. That is it!!