diff --git a/routeSQL.php b/routeSQL.php index c4b1934..a5bf1c9 100644 --- a/routeSQL.php +++ b/routeSQL.php @@ -60,6 +60,12 @@ class routeSQL The array must be of the form array ("linkname"=>,"icon"=>) icon is optional and the linkname is used if it is not provided */ public $internalLinks = array (); + /** The renderer class to use for HTML pages */ + public $rendererHTMLclass = false; + /** The renderer method to use for HTML pages */ + public $rendererHTMLmethod = false; + /** The layout HTML to use for HTML pages */ + public $rendererHTMLlayout = false; /** The model file containing the database description */ private $model_file = ""; @@ -553,7 +559,7 @@ class routeSQL $content .= " \n"; $content .= " \n"; // End of bottomBar $content .= "\n"; -echo $content; + $this->rendererhtml ($content); }); $route->get ($this->url_prefix."/{id}/delete/{token}", @@ -726,7 +732,7 @@ echo $content; unset ($field); $f->fields ($fields); $content .= $f->printHTML ("post", $values, $errors); -echo $content; + $this->rendererhtml ($content); }); $route->post ($this->url_prefix."/add", function ($chain) use ($route) @@ -919,7 +925,7 @@ echo $content; } $f->fields ($fields); $content .= $f->printHTML ("post", $values, $errors); -echo $content; + $this->rendererhtml ($content); }); $route->post ($this->url_prefix."/{id}", function ($id, $chain) use ($route) @@ -1075,4 +1081,33 @@ echo $content; return $datas[0]; return FALSE; } + + /** Display the data in HTML with the view class/method if they are defined */ + private function rendererhtml ($data) + { + require_once ("domframework/outputhtml.php"); + $route = new route (); + + $html = new outputhtml (); + $replacement = array ("{baseurl}"=>$route->baseURL ()); + if ($this->rendererHTMLlayout === false) + { + $this->rendererHTMLlayout = " + +
+