[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Raxan Framework Online Forum • View topic - [Plugin] URL Router
Page 1 of 1

[Plugin] URL Router

PostPosted: Tue Jan 04, 2011 2:36 pm
by raymond
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

complex usage of router

PostPosted: Fri Sep 28, 2012 10:45 am
by finaxis

Re: [Plugin] URL Router

PostPosted: Sun Oct 21, 2012 8:37 pm
by raymond
Hi Finaxis,

You can accomplish this by adding the .htaccess file to the app1 and app2 folders. Check out the attached example

__
Raymond

Re: [Plugin] URL Router

PostPosted: Fri Nov 16, 2012 8:22 am
by finaxis
Yes, it works perfect even after removing the 'app' folder. now I am using :
Root
->raxan
->app1
----->htaccess for app1
----->index.php for app1
->app2
----->htaccess for app2
----->index.php for app2
index.php for root
htaccess for root.

Your trouble shoot is just hitting a bulls eye. No doubt.
Cheers !