[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

[Plugin] URL Router

A place to share your Plugins and Extensions

[Plugin] URL Router

Postby raymond » Tue Jan 04, 2011 2:36 pm

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
Attachments
url.router.zip
URL Router Plugin (zip)
(2.84 KiB) Downloaded 2729 times
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

complex usage of router

Postby finaxis » Fri Sep 28, 2012 10:45 am

finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: [Plugin] URL Router

Postby raymond » Sun Oct 21, 2012 8:37 pm

Hi Finaxis,

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

__
Raymond
Attachments
example.zip
(4.83 KiB) Downloaded 2491 times
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Re: [Plugin] URL Router

Postby finaxis » Fri Nov 16, 2012 8:22 am

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 !
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm


Return to Plugins & Widgets

Who is online

Users browsing this forum: No registered users and 2 guests

cron