Using of menu item aliases in JoomlaPublished: Tuesday, 03 December 2013 23:05 Written by Ogri Hits: 12692
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
-
Tuesday, 21 July 2020 03:18
Joomla 3: Redirect to same page after successful login -
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
Articles Most Read
-
142191
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments -
73704
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
43984
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-2. Template, editor, and other extensions -
38803
Editing animated GIF-images in Photoshop CS3 -
36244
Migrating from Joomla 1.5 to Joomla 2.5. Part 1. Transferring content
Login
Guest Column
Recent comments
-
Custom 404 error page in Joomla 2.5
-
king855 29.05.2023 10:21
-
-
Joomla: Content filtering by articles, categories and components
-
sbobet singapore 29.05.2023 02:27
Join the sbobet online sports betting & casino today. Place sports and casino bets confidently - get ...
-
-
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments
-
오피쓰 30.05.2023 00:00
certainly like your web site however you have to test the spelling on quite a few of your posts. A ...
-
바카라사이트 29.05.2023 02:26
What i Ԁo not realize is іn truth how үοu are not actսally a lot mkre smartly-appreciated tһan yoᥙ ...
-
sbobet slot 28.05.2023 13:05
Spot on with this write-up, I actually think this amazing site needs far more attention. I'll probably ...
-
-
Migrating from Joomla 1.5 to Joomla 2.5. Introduction
-
바카라사이트 29.05.2023 11:30
Тhanks in suppor ߋf sharing ѕuch a fastidious opinion, post іѕ gօod,thatѕ ԝhy i have reаd iit entіrely ...
-
-
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-2. Template, editor, and other extensions
-
evolution casino 29.05.2023 20:09
Also visit my site; evolution casino ...
-
mega888 online 29.05.2023 16:02
Play the latest online casino games at mega888 and win big. Experience fun, thrilling, and exhilarating ...
-
tricks to baccarat 28.05.2023 12:15
Also visit my website ... tricks to baccarat: https://baccaratsg.com/
-
-
The structure of internal links within Joomla site
-
สล็อต 28.05.2023 08:07
4Jokers Casino เป็นสถานที่ที่สมบูรณ์แบบสำหรับการเล่นและรับรางวัลใหญ่! ด้วยสล็อต: https://4jokerscasino.com/ ...
-
Read more...