Mecha CMS

Deep learning on using the API.

Route

Table of Contents
  1. Patterns 

Do something if URL path matched with pattern.

1.0.02.0.02.2.0GenomeFinal

Patterns 

PatternDescription
:keyMatched with any but /
*Matched with any includes /
:{\d+}Matched with any value that pass to the regex pattern (\d+ in this case)
Route::set('test/:foo/:bar/:baz/*', function($foo, $bar, $baz, $qux) {
    test($foo, $bar, $baz, $qux);
    exit;
});

Note: You can’t match page offset to the route path, so, this won’t work:

Route::set('blog/2014/:i', function($i) {
    if ($i > 4) { … }
});

This will work:

Route::set('blog/2014', function() use($url) {
    if ($url->i > 4) { … }
});