Skip to content

View Routes

Stefan Segers edited this page Feb 15, 2021 · 3 revisions

If your route only needs to return a view, you have to use the Route::get method. Herefore the Router get method accepts a URI as its first argument and a view name as its second argument. This viewname points to the views map in the application map.

e.g. Router::get('/', 'welcome');

This means that the root of the applicationURL will point to the 'welcome.php' page in the application/views map.

In addition, you may provide an array of data to pass to the view as an optional third argument.

e.g. Router::get('/home','layouts/home',['name'=>'Roscoe Johns']);

This means that url/home points to application/views/home.php and that the home.php page has a variable $name and this variable gets the value 'Roscoe Johns'.

Clone this wiki locally