URL Router Plugin
----------------------------------
The URL Router plugin is used to map friendly MVC-style URLs to a Raxan page view. This is accomplished by using special segments within the url path:
URL format:
http://domain.com/page/view
http://domain.com/page/view/param
http://domain.com/page/view/param1/param2/paramN
Here's a break down of the above url format:
page - This represents the name of the web page (without the extension)
view - This represents the page view name to be loaded
param1...paramN - Parameters to be passed to the view.
URL Examples:
http://domain.com/admin/login - will be mapped to http://domain.com/admin.php?vu=login
http://domain.com/customer/edit/23 - will be mapped to http://domain.com/customer.php?vu=edit/23;
http://domain.com/customer/query/mary?age=25 - will be mapped to http://domain.com/customer.php?vu=query/mary&age=25;
Sample PHP Code:
class CustomerPage extends RaxanWebPage {
protected function _queryView() {
$param1 = $this->get->textVal(0);
$param2 = $this->get->textVal(1);
$param3 = $this->get->intVal(2);
// do something here
}
}
Installation
To use the url router plugin download the attached zip file and follow the steps below:
1. Copy url.router.php to raxan/plugins
2. Copy the files index.php and router.htaccess files to your web application root.
3. Rename router.htaccess to .htaccess
Now you're ready to start using friendly url's within your application or web site.
Note: The URL Router plugin requires a web server (e.g. apache) with mod_rewrite or compatible features enabled.
Additional plugin method
* createUrl() - Returns an MVC-style url if friendly url is supported
* createLink() - Returns hyperlink html
* redirectToView()- Redirects the browser to a new pageview