JRouter

From Joomla! Documentation
(Difference between revisions)
Jump to: navigation, search
m (bad link repair)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''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.
+
This class is available in the following Joomla versions:-
 
+
<splist showpath=notparent />
===Availability===
+
<noinclude>[[Category:Platform JClasses]][[Category:JRouter]]</noinclude>
{{JVer|1.5|From Joomla 1.5}} {{JVer|1.6|Joomla 1.6}}
+
 
+
===Defined in===
+
/joomla/application/router.php
+
 
+
===Extends===
+
* [[JObject]]
+
 
+
===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|JObject->get]] method.
+
{| class="wikitable"
+
|-
+
!Get method
+
!Set method
+
!Description
+
!Property
+
|-
+
|[[JRouter/getMode|getMode]]
+
|[[JRouter/setMode|setMode]]
+
|Give access to the router mode
+
|<code>$router->_mode</code>
+
|-
+
|[[JRouter/getVar|getVar]]
+
|[[JRouter/setVar|setVar]]
+
|Give access to router variables
+
|<code>$router->_vars[$key]</code>
+
|-
+
|[[JRouter/getVars|getVars]]
+
|[[JRouter/setVars|setVars]]
+
|Get and set router variables
+
|<code>$router->_vars</code>
+
|}
+
 
+
===Methods===
+
{| class="wikitable"
+
|-
+
!Method name
+
!Description
+
|-
+
|[[JRouter/__construct|__construct]]
+
|Constructor
+
|-
+
|[[JRouter/attachBuildRule|attachBuildRule]]
+
|Adds a callback function to the stack of build rules
+
|-
+
|[[JRouter/attachParseRule|attachParseRule]]
+
|Adds a callback function to the stack of parse rules
+
|-
+
|[[JRouter/build|build]]
+
|Converts an internal URI to a route. See also the [[JRouter/parse|parse]] method.
+
|-
+
|[[JRouter/getInstance|getInstance]]
+
|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]]
+
|Converts a route to an internal URI. See also the [[JRouter/build|build]] method.
+
|-
+
 
+
|-
+
|}
+
===Importing===
+
<source lang="php">jimport( 'joomla.application.router' );</source>
+
 
+
===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 <code>includes/router.php</code>.
+
 
+
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 [[Routing|article]] and visit the section ''The Component Router''
+
 
+
===See also===
+
* [http://api.joomla.org/Joomla-Framework/Application/JRouter.html JRouter on api.joomla.org]
+
<noinclude>[[Category:Development]][[Category:Framework]][[Category:JRouter]]</noinclude>
+

Latest revision as of 14:01, 29 August 2012

This class is available in the following Joomla versions:-

Page "JRouter" has no subpages to list.
Personal tools
Namespaces

Variants
Actions
Navigation
Joomla! Sites
Toolbox