Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f3b1c20a72
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 97 lines (88 sloc) 4.074 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/

/**
* The routes file is where you define your URL structure, which is an important part of the
* [information architecture](http://en.wikipedia.org/wiki/Information_architecture) of your
* application. Here, you can use _routes_ to match up URL pattern strings to a set of parameters,
* usually including a controller and action to dispatch matching requests to. For more information,
* see the `Router` and `Route` classes.
*
* @see lithium\net\http\Router
* @see lithium\net\http\Route
*/
use lithium\net\http\Router;
use lithium\core\Environment;

/**
* With globalization enabled a localized route is configured by connecting a
* continuation route. Once the route has been connected, all the other
* application routes become localized and may now carry a locale.
*
* Requests to routes like `/en/posts/edit/1138` or `/fr/posts/edit/1138` will
* carry a locale, while `/posts/edit/1138` keeps on working as it did before.
*/
if ($locales = Environment::get('locales')) {
$template = '/{:locale:' . join('|', array_keys($locales)) . '}/{:args}';
Router::connect($template, array(), array('continue' => true));
}

/**
* Here, we are connecting `'/'` (the base path) to controller called `'Pages'`,
* its action called `view()`, and we pass a param to select the view file
* to use (in this case, `/views/pages/home.html.php`; see `app\controllers\PagesController`
* for details).
*
* @see app\controllers\PagesController
*/
Router::connect('/', 'Pages::view');

/**
* Connect the rest of `PagesController`'s URLs. This will route URLs like `/pages/about` to
* `PagesController`, rendering `/views/pages/about.html.php` as a static page.
*/
Router::connect('/pages/{:args}', 'Pages::view');

/**
* Add the testing routes. These routes are only connected in non-production environments, and allow
* browser-based access to the test suite for running unit and integration tests for the Lithium
* core, as well as your own application and any other loaded plugins or frameworks. Browse to
* [http://path/to/app/test](/test) to run tests.
*/
if (!Environment::is('production')) {
Router::connect('/test/{:args}', array('controller' => 'lithium\test\Controller'));
Router::connect('/test', array('controller' => 'lithium\test\Controller'));
}

/**
* ### Database object routes
*
* The routes below are used primarily for accessing database objects, where `{:id}` corresponds to
* the primary key of the database object, and can be accessed in the controller as
* `$this->request->id`.
*
* If you're using a relational database, such as MySQL, SQLite or Postgres, where the primary key
* is an integer, uncomment the routes below to enable URLs like `/posts/edit/1138`,
* `/posts/view/1138.json`, etc.
*/
// Router::connect('/{:controller}/{:action}/{:id:\d+}.{:type}', array('id' => null));
// Router::connect('/{:controller}/{:action}/{:id:\d+}');

/**
* If you're using a document-oriented database, such as CouchDB or MongoDB, or another type of
* database which uses 24-character hexidecimal values as primary keys, uncomment the routes below.
*/
// Router::connect('/{:controller}/{:action}/{:id:[0-9a-f]{24}}.{:type}', array('id' => null));
// Router::connect('/{:controller}/{:action}/{:id:[0-9a-f]{24}}');

/**
* Finally, connect the default route. This route acts as a catch-all, intercepting requests in the
* following forms:
*
* - `/foo/bar`: Routes to `FooController::bar()` with no parameters passed.
* - `/foo/bar/param1/param2`: Routes to `FooController::bar('param1, 'param2')`.
* - `/foo`: Routes to `FooController::index()`, since `'index'` is assumed to be the action if none
* is otherwise specified.
*
* In almost all cases, custom routes should be added above this one, since route-matching works in
* a top-down fashion.
*/
Router::connect('/{:controller}/{:action}/{:args}');

?>
Something went wrong with that request. Please try again.