webCOMAND

controller::show_404()

Produce a 404 Not Found response, which is useful when a controller can not locate a requested resource.

This is just a shortcut to the static method view::show_404().

Prototype

void show_404(string $message = '', string $filename = NULL)

Parameters

  • message - Optional message to display on 404 page.  Can contain HTML.
  • filename - Optional path to a cMVC view that will receive the message as $message.

Example

// the show controller method
public function web__show($oid=0) {
    $repo = $this->repo();
    $object = $repo->get_by_oid($oid);
    if(!$object){
        $repo = $this->show_404('Object Not Found');
    }
    echo('Found object: ' . $object->Summary());
}