John Crumpton

Archive for the ‘joomla’ Category

There are times when you want to hide Joomla’s breadcrumb, for example the homepage or search results.

In your template add the following where you want your breadcrumbs to appear:

<div id="breadcrumbs">
<?php
if ( ( $_REQUEST['option'] != "com_frontpage" ) and ( $_REQUEST['option'] != "com_search" ) and ( $_REQUEST['option'] != "com_xmap" ) ) { ?>
    <jdoc:include type="modules" name="breadcrumbs" />
     <?php } ?>
&nbsp;</div>

This hides the breadcrumb from the home page (com_frontpage) the search results (com_search) and the site map, in this case Xmap (com_xmap). Make sure your breadcrumb mobile appears in the “breadcrumb” module position.

To hide a specific page add:

 ( $_REQUEST['id'] != "8" )

Where 8 is the id of that page. You can also do this for a task as well as an option, just adjust $_REQUEST['option'] to $_REQUEST['task'].

If you use several templates on your Joomla site, such as a homepage template and a global template, you’ll know that the search results page irritatingly uses the homepage template and not your global template.

It is possible to change this by adding a hidden field to the search module, here’s how:

Within your homepage template folder create a new directory called “html” and then “mod_search”

Copy the “default.php” file from /modules/mod_search/tmpl/ into your newly created “mod_search” folder under your template folder.

Open this file at near the bottom just before the end of the form add:

 <input type="hidden" name="Itemid" value="2" />

The value refers to the menu item, we need to create a new hidden menu in the administrator, add a search menu item, make a note of the menu’s Item ID, then add this to the above code under the value.

Don’t publish the hidden menu in the module manager, we’ve just creating this to get the Item ID of the search page.