URL helper

There are 3 shortcut functions which you can use:


    echo url('/about/');

    echo url('/about/', array('name' => 'Craig'));

    echo url('/about/:page/', array('page' => 'contact', 'name' => 'Craig'));

    echo url('./history/');


    echo http_url('/about/');

You can view the source on GitHub.


If the same base url will be used with different parameters, try:

$edit_url = url('/admin/edit/');

echo $edit_url->get(array('id' => 15));

Individual parameters can be set in a number of ways, for example:

$test_url = url('/path/:a/', array('a' => 1, 'b' => 2));
$test_url->param_set('c', 3);
$test_url->param_set(array('d' => 4, 'e' => 5));

echo $test_url->get(array('f' => 6));

URL Setup

If your not using the http_url() helper function, you can also require a 'full' url via:

$home_url = url('/');

Or set a the scheme (implying a full url) with:

$home_url = url('/');

Likewise the different component parts can be set/retrieved with:

$test_url = url('/path/', array('a' => 1, 'b' => 2));


$test_url->host_get(); // Not normally used, see config::get('output.domain')

$test_url->param_set('c', 3);
$test_url->param_set(array('d' => 4, 'e' => 5));

Site config


    absolute = default
    full = includes domain
    relative = not implemented yet


    Prefixed onto any absolute urls, for example:

        config::set('url.prefix', '/en');
        echo url('/about/');