Jeff PHP framework  0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
router Class Reference

Framework router class. More...

Public Member Functions

 __construct ($base_path)
 Constructs a router instance.
 getModule ($route)
 Sets the module and method properties.
 linkAjax ($module, $method, $params=array())
 Ajax link generation.
 linkHref ($module, $method, $params=array(), $opts=null)
 Link generation.
 loader ($route)
 Loads a module controller and returns its called method.
 method ()
 Returns the method called by url.
 module ()
 Returns the module called by url.

Private Attributes

 $_base_path
 base path for link generation
 $_method
 method called by url
 $_module
 module called by url
 $_registry
 the registry singleton instance

Detailed Description

Framework router class.

This class is used to load/call class methods, it includes the proper class file, instantiates the module's controller and call its method. Also it exports the url module and method to use for example in the template factory.

Author:
abidibo abidi.nosp@m.bo@g.nosp@m.mail..nosp@m.com
Version:
0.99
Date:
2011-2012

Definition at line 25 of file router.class.php.


Constructor & Destructor Documentation

router::__construct ( base_path)

Constructs a router instance.

Parameters:
string$base_paththe base path
Returns:
void

Definition at line 53 of file router.class.php.

+ Here is the call graph for this function:


Member Function Documentation

router::getModule ( route)

Sets the module and method properties.

Parameters:
array$routethe class and method to set. Possible values are:
  • associative array in the form array('module'=>'module_name', 'method'=>'method_name')
  • null: the class name and method name are taken directly from url
Returns:
void

Definition at line 131 of file router.class.php.

+ Here is the caller graph for this function:

router::linkAjax ( module,
method,
params = array() 
)

Ajax link generation.

This method is used to generate links which points directly to a controller class method, without considering the whole document (themes, templates and so on). Generally used to perform ajax requests.

Parameters:
string$modulemodule name (the name of the model class)
string$methodmethod name
array$paramsassociative array of parameters in the form array('param_name'=>'param_value')
Returns:
void

Definition at line 187 of file router.class.php.

router::linkHref ( module,
method,
params = array(),
opts = null 
)

Link generation.

This method is used to generate links starting from a module name, one of its methods and additional parameters

Parameters:
string$modulemodule name (the name of the model class)
string$methodmethod name
array$paramsassociative array of parameters in the form array('param_name'=>'param_value')
mixed$optsassociative array of oprions:
  • permalink: whether to use permalinks or not (i.e. '/class/method/param/value' 'against /index.php?module=class&method=method&param=value'
Returns:
void

Definition at line 158 of file router.class.php.

+ Here is the call graph for this function:

router::loader ( route)

Loads a module controller and returns its called method.

Parameters:
array$routethe class and method to call. Possible values are:
  • associative array in the form array('module'=>'module_name', 'method'=>'method_name')
  • null: the class name and method name are taken directly from url if the method is not found or not callable the 'index' method is called public
Returns:
the controller method output or a system error

Definition at line 93 of file router.class.php.

+ Here is the call graph for this function:

Returns the method called by url.

Returns:
the url method name

Definition at line 76 of file router.class.php.

Returns the module called by url.

Returns:
the url module name

Definition at line 65 of file router.class.php.


Field Documentation

base path for link generation

Definition at line 35 of file router.class.php.

router::$_method [private]

method called by url

Definition at line 45 of file router.class.php.

router::$_module [private]

module called by url

Definition at line 40 of file router.class.php.

router::$_registry [private]

the registry singleton instance

Definition at line 30 of file router.class.php.


The documentation for this class was generated from the following file: