JRouter

From Joomla! Documentation
(Difference between revisions)
Jump to: navigation, search
Line 55: Line 55:
 
|[[JRouter/getInstance|getInstance]]
 
|[[JRouter/getInstance|getInstance]]
 
|Returns a reference to the global JRouter object, only creating it if it doesn't already exist
 
|Returns a reference to the global JRouter object, only creating it if it doesn't already exist
|-
 
|[[JRouter/getMode|getMode]]
 
|Get the router mode
 
 
|-
 
|-
 
|[[JRouter/parse|parse]]
 
|[[JRouter/parse|parse]]
Line 75: Line 72:
 
===See also===
 
===See also===
 
* [http://api.joomla.org/Joomla-Framework/Application/JRouter.html JRouter on api.joomla.org]
 
* [http://api.joomla.org/Joomla-Framework/Application/JRouter.html JRouter on api.joomla.org]
 +
* [[Routing|Guide to create your own component routing handlers]]
 
<noinclude>[[Category:Development]][[Category:Framework]][[Category:JRouter]]</noinclude>
 
<noinclude>[[Category:Development]][[Category:Framework]][[Category:JRouter]]</noinclude>

Revision as of 03:20, 9 August 2009

JRouter is an abstract class to create an parse routes. You need to write your own concrete Router Class to make use of its functionality. The Joomla CMS uses the JRouterSite class as concrete Router implementation. For further information see below.

Contents

Availability

From Joomla 1.5 Joomla 1.6

Defined in

/joomla/application/router.php

Extends

Get and Set Methods

Properties which do not have specific get or set methods listed here can be retrieved or set using the inherited JObject->get method.

Get method Set method Description Property
getMode setMode Give access to the router mode $router->_mode
getVar setVar Give access to router variables $router->_vars[$key]
getVars setVars Get and set router variables $router->_vars

Methods

Method name Description
__construct Constructor
attachBuildRule Adds a callback function to the stack of build rules
attachParseRule Adds a callback function to the stack of parse rules
build Converts an internal URI to a route. See also the parse method.
getInstance Returns a reference to the global JRouter object, only creating it if it doesn't already exist
parse Converts a route to an internal URI. See also the build method.

Importing

jimport( 'joomla.application.router' );

JRouter, the Joomla CMS and writing your own SEO components

JRouter is an abstract class of the Joomla Framework. The Joomla CMS is a concrete application, using the Joomla Framework. Thus, they have created their own concrete Router class, which handles routes. This concrete Router is called JRouterSite and can be found in includes/router.php.

If you take a look at the private _buildSefRoute method of this class, you'll quickly realise that the Joomla Developers allow you to create your own custom routing handlers for each of your components. This way, you can make your components SEO friendly. If you want to learn, how to write such an handler take a look at this article and visit the section The Component Router

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Joomla! Sites
Toolbox