In a previous article I described the process of transferring content from source site to destination site and integration it as a separate section into the destination site structure. Component J2XML accomplished the task well enough. I would rate it "excellent", but, as noted later in that article, its functionality does not include the transfer and integration of menu structure. However, it did not take long to manually reproduce it on the site-receiver. But when I started to bind menu items to the corresponding elements of content, I have encountered with a certain problem. It is in the process of solving I got acquainted for the first time in my practice with the option placed in the title of this article.

Let me describe the problem. The source site has several menus. The need is to place them at the destination site in the same form - as separate modules, but since the new content is conceived to be a separate section, all sub-sections must include the name and alias of the parent section - in the URL and the breadcrumbs. But the menus, corresponding to the sub-sections, should remain the root level menus. However, if the second condition is satisfied then the first one is not. This is where the option of choosing menu item type as an alias of another menu item became helpful.

The logic of the problem appearance becomes clear when I will illustrate it with particular example. For greater clarity, I will replace narrow subject of my site with more popular one - namely cars. I hope that ladies forgive me for the theme, usually more interesting for gents )).

Thus, we assume that a site of the automotive topics is joined to another site in the capacity of the "Cars" section. After importing through J2HML, a new structure has been added to the categories structure. This new hierarchy of categories is of the following form:


Here we have introduced the root category, corresponding to the new section - "Cars." It includes two subcategories of first-level nesting - "About the Project" and "Project News". They are supposed to correspond to a separate menu, "Cars", containing general information about the project.

3 more categories of the same level - Honda, Audi and Ford - in turn contain subcategories. These three categories should form another menu, this time a two-level - "Car Catalogue". It should look something like this:


First, we create both menus, linking their items as it was on the source site. The first menu:


The second menu:


Add modules for each of the menu and publish them in the desired position (in my case - left column). Menus are displayed exactly as planned. However, links, corresponding to their items and sub, though open the correct pages, do not correspond to the intended concept. Consider, for example, the first item "About the Project" of the first menu "Cars". URL of this item has the form

while in theory the URL should include alias of the entire section:

Breadcrumbs, respectively, also do not include an intermediate URL of the section.

Let's try to create one menu instead of two with a structure that exactly match the structure of categories, and name it "Cars-ALL". Here it is:


Create and publish the module for this menu, and see the following pattern on the site:


Links and navigator are now as intended, but the menu itself - far from it. All in a heap, the root item duplicates section heading, and also "Car Catalogue" is now missing. Wrong result again. We must invent something.

You may recall that menu module has an option "Start Level." Let's try to shift the entry-level of our unified menu to one level deeper. Change the value from 1 to 2. Save.


Returning to the site and reloading the main page, we find that there is no such menu at all. It appears only in the branch "cars/". The root item is no longer displayed. In principle, this corresponds to my idea; it remains only to return to the version of two separate menus, add to each of them the root item "Cars", and set the "Start Level" equal to 2 in module settings. However, what if you later want to display these menus on the pages beyond the branch "cars/"? This technique does not provide such a possibility, and therefore is not universal enough.

And here we finally came to the topic of the article. The option to choose the type of the menu item as an alias of another item of the same or another menu had been appeared in Joomla since version 1.6. Using this allows you to solve the problem and keep full control over linkage of the menus to the site pages. Small fee for this - the fact that for each page we will have to create two menu items, but it doesn't bother us, we are not lazy, are we?

So, we proceed to the final realization of our idea. All you need for this is already there: the "Cars-ALL" menu, containing the complete hierarchy of all items distributed to required levels (module for this menu, by the way, is not required) and two more menus - "Cars" and "Car Catalogue". Herewith items of the first menu are of the standard types - "Single Article", "Category List", "Category Blog", etc., as it was on the source website. In the rest menus change all the items' types to "Menu Item Alias", and they will refer to the relevant items of the first menu.


Thus, URLs and breadcrumbs are determined by levels of the aggregate menu, while the menus output on the site and binding to the pages - by the rest of the menus and settings of their modules.

Generally, the option to assign menu item type as an alias of other item has more standard usage - for example, to duplicate the main menu in the footer of the website. Then, if you change the main item settings, the menu item referring to it automatically picks up the new value. Apparently, this function has been initially introduced for cloning the menus. But the example of this option usage, described in this article, is itself an evidence of the fact that the scope, offered by developers of CMS Joomla, can often be extended to solve other problems. Flexibility of the system takes place, which is great.

Users must be registered and logged in to post comments.

By working with this site, you agree to our use of cookies necessary to keep the settings you select, as well as for the normal operation of Google services.