J3.x

How to add breadcrumbs

From Joomla! Documentation

This page contains changes which are not marked for translation.
Other languages:
English • ‎Nederlands • ‎español • ‎français
Joomla! 
3.x
series

Breadcrumbs are a nice way to display the connection from the root. It gives you a hierarchical representation with clickable links so that user can visit upper links easily. Breadcrumbs can be added in templates by using the object returned by $mainframe->getPathWay(). The member function addItem() allows you to add a breadcrumb with the title of your choice.

There are two parameters used for breadcrumbs creation process. The first is the title for the breadcrumb and the second is the URL. If we do not need the breadcrumb to work as a link then we simply pass a blank string and it will not be a clickable URL. This term is useful for hierarchical components where we have subcategories: we can generate a link to each and then end with the title of the current record or category.

The JPathway is used by the breadcrumbs module. If you are adding a new component and have already configured breadcrumbs, you may need to go into the breadcrumbs configuration and add the menu item of your component to the menu selection list.

Example[edit]

Joomla 3.10 The display function from a view's view.php for Joomla! 3.x could look like this.

public function display($tpl = null)
{

$app	= JFactory::getApplication();
$pathway = $app->getPathway();
$pathway->addItem('My Added Breadcrumb Link', 'http://www.yourdomain.tld');

parent::display($tpl);

}

See Also[edit]