Skip to content
adampatterson edited this page Oct 27, 2012 · 3 revisions

Overview

The URL library is designed to make it easier for you to manage URLs for your application. To load the URL library manually you may do this:

load::library('url');

Page

Returns the full URL to a page in your application. It automatically adjusts if you are using Fancy URLs. If you wanted the URL of a page mycontroller/myfunc then you would do this:

// EX: http://www.evanbot.com/index.php/mycontroller/myfunc
$url = url::page('mycontroller/myfunc');

Base

Returns the base URL to your application.

// EX: http://www.evanbot.com/
$application_base = url::base();

If you set the optional first argument to TRUE then it will append index.php/ onto the URL if you are not using Fancy URLs.

// EX: http://www.evanbot.com/index.php/
$application_base = url::base(TRUE);

Redirect

Redirects the user's browser to another page in your application. To redirect the user to mycontroller/myfunc then you would do this:

url::redirect('mycontroller/myfunc');