Catching urls with a controller
PermalinkIs it possible to 'catch' urls with a controller?
Lets say I have this url:
/something/somethingmore/
But there is no page called somethingmore. It's a page I want to create dynamically. So I would like a controller to be called when the url starts with /something/ and then build the page based on the remaining part of the url. How would I do that?

Anything else in the URL gets passed to the controller's method as a parameter. So if you have your singlepage, with a default method you can handle a dynamic/unknown page in that method and output what you need dependent on what is passed. You just need to decide on a naming convention for the single page controller and method.
http://site/singlepagecontroller/method/whatever/you/want...
Hope that helps
$req = Request::get(); $path = $req->getRequestPath(); //this is the path requested
Then do checks to see if it is an invalid page, if so
$v = View::getInstance(); $v->render('/path/to/singlepage', array('path'=>$path)); //passes the $path variable
try doing that in an on_start method
If you're expecting a url like /something/somethingmore/arg1/arg2, you'd want a method like public function view($page, $arg = null, $arg2 = null) {}. Otherwise c5 says "i have three arguments and no method will accept those, must be a 404".