Controller
When I make some conditional checks to see if some url is a valid one or if it should return 404 in a controller I need to use:
if( $page->status() == 'hah' ) {
header::redirect( $site->errorPage() );
}
While it work I don’t like to redirect it. I would prefer to show the 404 message on that url. Another issue is that it appear in the Google Webmaster Tools:
It’s not really a page, so why is it needed as an url anyway!?
In a route we can use the visit()
but a route might not have all the information we need.
Better visit function
I want a better visit()
function that is not just for routes, but for controllers or functions or even in the header.php
snippet (before anything else loads).
In my world it would be nice if it would look like this:
echo $site->visit('some/uri', $lang);
die;
I would not mind calling it something else if this is kind of bound to the routes, something like:
echo $site->emulate('some/uri', $lang);
die;