Index, default and 404 templates

Initially when installing MV framework there are 3 templates for website pages in folder "views".

  1. view-ndex.php - the main page of website (empty URL, request "index.php" or "/index/")
  2. view-default.php - default template (if no match in router was found)
  3. view-404.php - 404 error template (accompanied by 404 http header)

Sample of template "view-default.php" file.

 <?
//Based on passed URL we define page search parameters in database
//Search result returns as an object of Record class or false if no page found 
$content = $mv -> pages -> defineCurrentPage($mv -> router);
 
//If no page found, then redirect to 404 error with http header
$mv -> display404($content);
 
include $mv -> views_path."main-header.php"; //Top part of template 
?>

... //Main content of the page

<?
include $mv -> views_path."main-footer.php"; //Bottom part of template 
?>

Additional samples how to work with default templates can be found in Launch of simple website section.