ADBLOCK_MSG
Breadcrumbs, also known as site navigator, is useful Joomla module. And, as every module, it can be linked to all or only certain menu items. It is also possible to unlink this module from all or specific items. Many Joomla website owners wish to hide navigator on the home page, since it contains only one item "Home" with no link and does not incurs thus any functional load. Perhaps the site structure also provides other pages on which, for whatever reasons, it makes sense to hide navigator. The most typical example is a custom 404 error page, which, as I emphasize in the corresponding article dedicated to the rules of its creation and configuration, should fit into a site template, but at the same time to be by itself. Navigator on page 404 is not only unnecessary, but also ideologically harmful. We will consider this particular page as a special case, which describes the general principle of unlinking breadcrumbs from certain article.
The standard way to the module linking is not suitable here, since, as described in the above article, the menu item for the error page is not being created. In fact, such item can nevertheless be created (without binding it to a page, but only to link modules - such as breadcrumbs in our case). Then you can hide the navigator for this page by selecting On all pages except those selected in Module Assignment dropdown box on the page of editing module parameters in the site's admin interface. Such a method works well in this case; when adding new items to the different menues breadcrumbs will automatically get attached to them, so it is not required to do it manually every time (unlike the alternative Only on the pages selected; there it is necessary to manually add each created menu item to the module). However, its disadvantage is the need to create menu items for articles, even when there is no other need of this binding. All these menues are added as additional tabs in the Menu Selection sections of all modules, and interface becomes overloaded. This issue particularly reveals itself in case of multi-language, where you have to separately create a menu for each language, and, accordingly, the number of tabs in the module editing interface increases in proportion to the number of languages.
Given the above reasons, I prefer an alternative solution. Though it will require some skills of reading and editing PHP-code. Yet, if you are carefully following these instruction, the minimal knowledge is sufficient.
We will start, as always, with identification of the file and the place in its code, which will be edited. Breadcrumbs module has a separate position, which is set in the index.php
file of the active template. It is located in the folder templates\[my_template]
. Replace [my_template]
with the real name of your template's folder. Open the file for editing and find the occurrence of navigator module in its code. There are different options. For example, in templates Beez2 and Beez5 that are supplied with Joomla, the desired piece of code looks like this:
<div id="breadcrumbs"> <jdoc:include type="modules" name="position-2" /> </div>
In my custom template, whose structure was built in Artisteer, navigator is brought out using a special function artxPost, and its call in index.php
looks like this:
if ($view->containsModules('breadcrumb') echo artxPost($view->position('breadcrumb'));
In other templates the code of breadcrumbs may be different, but the general principle is to find the right place in the code by searching either the word "breadcrumb", or, if in your template the module is located in a position with less intuitively appropriate name - so search for this name. It's easy to ascertain module's position by opening its editing page in the administration service. Preview in template manager may also clarify module position (if to previously enable the Preview Module Positions option in its settings).
Now we assign a code to disable the output of the module according to our conditions. If you simply want to remove it from the home page, the criterion is:
JRequest::getVar('view') != 'frontpage'
Applying it to the first example (Beez2 or Beez5), substitute the following portion of code for the above one:
<div id="breadcrumbs"> <?php if (JRequest::getVar('view') != 'frontpage') { ?> <jdoc:include type="modules" name="position-2" /> <?php } ?> </div>
In the second example (template built in Artisteer) the modified code will be the following:
if ($view->containsModules('breadcrumb') && JRequest::getVar('view') != 'frontpage') echo artxPost($view->position('breadcrumb'));
We now return to the situation where you want to remove the navigator module from specific article pages. Consider the case of a multilingual site (namely - bilingual, like mine is at the time of this writing), and eliminate breadcrumbs on both English and Russian pages 404. At first find out IDs of corresponding articles. This is easily done by finding them in the list of articles in the admin service. In my case, the identifier of Russian page is 80, and the ID of the English one is 448. The following code fragments intended, as in the previous case, to replace the existing ones. Just replace my values of IDs with yours (read more about that construction in an article describing the methodology of selective output of social media buttons).
<div id="breadcrumbs"> <?php $article_id = explode(':', JRequest::getVar('id')); if (!(JRequest::getVar('view') == 'article' && ($article_id[0] == '80' || $article_id[0] == '448'))) { ?> <jdoc:include type="modules" name="position-2" /> <?php } ?> </div>
if ($view->containsModules('breadcrumb') && !(JRequest::getVar('view') == 'article' && ($article_id[0] == '80' || $article_id[0] == '448'))) { echo artxPost($view->position('breadcrumb'));
Using this technique you can hide the breadcrumbs on any other pages by simply adding their IDs to the clause. You can also invert the logics and remove the navigator from all articles other than those listed (details - ibid). And finally - it allows you to manipulate with other modules which allocated in separate positions in your web site's main template.
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
-
148792
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments -
83397
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
56656
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-2. Template, editor, and other extensions -
40060
Editing animated GIF-images in Photoshop CS3 -
39192
Custom 404 error page in Joomla 2.5
Login
Guest Column
Recent comments
-
Custom 404 error page in Joomla 2.5
- Roseann 02.11.2020 08:17
-
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments
-
PG SLOT
13.01.2021 09:21
Hey! I could have sworn I've been to this site before but after browsing through some of the post ...
-
Nidia
12.12.2020 08:04
HELP. I can't write a comment without it hanging.
-
Launa
17.11.2020 15:13
I can agree with the accuracy of this as I work in a related sector. Interesting cheers for sharing.
-
JD sports vouchers
04.10.2020 03:12
Happy to pay for something like this, or donate witth paypal even
-
PG SLOT
13.01.2021 09:21
-
Joomla: how to add your own language constants or override existing ones
-
Vouchersort
29.10.2020 11:33
Is this a free template that you are using as I really love it. As a website desugner myself I hope that ...
-
Vouchersort
29.10.2020 11:33
-
Migrating from Joomla 1.5 to Joomla 2.5. Epilogue
-
Dewitt
11.02.2021 06:17
HELP. I can't write a comment without the page freezing.
-
Dewitt
11.02.2021 06:17
-
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments
-
Francine
14.12.2020 08:49
I cant stomach this person so sorry x
-
Vouchersort
30.10.2020 15:43
Once again, great resource for us newbs.
-
Francine
14.12.2020 08:49
-
Unified filtering of mod_jcomments_latest module's output
-
Фильмы 2022 онлайн
03.12.2021 21:37
This web site definitely has all of the info I wanted about this subject and didn't know who to ask.
-
Фильмы 2022 онлайн
03.12.2021 21:37
Read more...