Using of menu item aliases in JoomlaPublished: Tuesday, 03 December 2013 23:05 Written by Ogri Hits: 7891
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
http://ogri.me/en/about-the-project
while in theory the URL should include alias of the entire section:
http://ogri.me/en/cars/about-the-project
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.
Latest News
-
Saturday, 30 December 2017 16:11
Joomla: how to add your own language constants or override existing ones -
Thursday, 30 November 2017 23:27
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
Saturday, 25 June 2016 15:33
Unified filtering of mod_jcomments_latest module's output -
Thursday, 17 September 2015 16:23
Post an illustrated Joomla-site article on Facebook using OG-tags -
Friday, 27 June 2014 13:35
Joomla: Content filtering by articles, categories and components
Articles Most Read
-
83541
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments -
27757
Editing animated GIF-images in Photoshop CS3 -
22184
Social Media Buttons in Joomla 2.5 -
22175
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-2. Template, editor, and other extensions -
21127
Migrating from Joomla 1.5 to Joomla 2.5. Part 1. Transferring content
Login
Guest Column
Recent comments
-
Editing animated GIF-images in Photoshop CS3
-
Lita Maivia 10.03.2016 22:22
-
Ogri 21.02.2015 00:01
You are welcome. I'm glad to have positive feedback.
-
Ryoko 20.02.2015 23:20
Thank you very much... This could help me a lot! ^^
-
-
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments
-
CHANHOTT 28.11.2018 04:21
Thank You
-
-
Joomla: Merge two sites into one using component J2XML
-
Ogri 11.01.2015 14:23
Hi Jenny, Sorry for the late response. As a matter of fact, you do not have to configure your web ...
-
Jenny McWilliam 31.12.2014 01:26
Hi , I am very interested in your article as I am trying to use J2XML and there is virtually NO ...
-
-
Photoshop: Processing photos of paintings for online gallery
-
siva 12.12.2017 06:13
Great work done. It is really good to visit your website and learn informative. I like the way you ...
-
geoff edwards 03.10.2017 10:56
Very clear instructions! One of the best Photoshop videos I have found. Even photographing art ...
-
-
Post an illustrated Joomla-site article on Facebook using OG-tags
-
writing service 09.05.2017 06:17
This article is use simple, straightforward sentences with few modifying phrases and clauses.I enjoy ...
-
-
Unified filtering of mod_jcomments_latest module's output
-
123movies 05.09.2018 17:54
Please let me know if you're looking for a writer for your blog. You have some really great posts and ...
-
Read more...