J1.5

Difference between revisions of "How to add breadcrumbs"

From Joomla! Documentation

(New page: Breadcrumbs are nice way to display the connection from the root. It gives you a hierarchical representation with click able links so that user can visit upper links easily. Breadcrumbs ca...)
 
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
{{version/tutor|1.5}}
 
Breadcrumbs are nice way to display the connection from the root. It gives you a hierarchical representation with click able 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 to add a breadcrumb with the title of choice.  
 
Breadcrumbs are nice way to display the connection from the root. It gives you a hierarchical representation with click able 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 to add a breadcrumb with the title of choice.  
  
 
There are two parameters used for breadcrumbs creation process, and the first parameter is the title for the breadcrumb and the second parameter is the URL. If we do not need the breadcrumb to work like a link then we need to simply pass a blank string and then it will not work like a click able 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.
 
There are two parameters used for breadcrumbs creation process, and the first parameter is the title for the breadcrumb and the second parameter is the URL. If we do not need the breadcrumb to work like a link then we need to simply pass a blank string and then it will not work like a click able 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 currently 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 for you component to the selection on the menu selelist.
 +
 +
== Example ==
 +
{{JVer|1.5}}
 +
A view's view.php could look something like this.
 +
<pre>
 +
class exampleViewdefault extends JView {
 +
function display($tpl = null) {
 +
 +
 +
$mainframe = &JFactory::getApplication();
 +
$document  = &JFactory::getDocument();
 +
$pathway  =& $mainframe->getPathway();
 +
 +
 +
JHTML::_('behavior.modal');
 +
$model =& $this->getModel();
 +
$data = $model->getData();
 +
 +
$this->assignRef( 'events', $data);
 +
 +
$document->setTitle( $this->events['name'] );
 +
$pathway->addItem($this->events['name'], '');
 +
 +
parent::display($tpl);
 +
 +
}
 +
}
 +
</pre>
 +
 +
== See Also==
 +
* http://docs.joomla.org/JPathway
 +
* http://api.joomla.org/1.5/Joomla-Framework/Application/JPathway.html
 +
* http://api.joomla.org/11.4/Joomla-Platform/Application/JPathway.html
 +
* http://docs.joomla.org/API16:JPathway
 +
 +
[[Category:Archived version Joomla! 1.5]]

Latest revision as of 21:09, 7 June 2013

The "J1.5" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Breadcrumbs are nice way to display the connection from the root. It gives you a hierarchical representation with click able 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 to add a breadcrumb with the title of choice.

There are two parameters used for breadcrumbs creation process, and the first parameter is the title for the breadcrumb and the second parameter is the URL. If we do not need the breadcrumb to work like a link then we need to simply pass a blank string and then it will not work like a click able 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 currently 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 for you component to the selection on the menu selelist.

Example[edit]

Joomla 1.5 A view's view.php could look something like this.

class exampleViewdefault extends JView {
	function display($tpl = null) {

		
		$mainframe = &JFactory::getApplication();
		$document  = &JFactory::getDocument();		
		$pathway   =& $mainframe->getPathway();


		JHTML::_('behavior.modal');
		$model =& $this->getModel();
		$data = $model->getData();

		$this->assignRef( 'events', $data);

		$document->setTitle( $this->events['name'] );		
		$pathway->addItem($this->events['name'], '');

		parent::display($tpl);

	}
}

See Also[edit]