The Page Class allows you to separate the Code to the Front End (HTML), This object also minified your JavaScript code and cached your views, increasing the performance of your site.
The following code loads a template inside become:
require("com/ui/Page.php");
final class Index extends Page {
public function Index (){
parent::Page("index.html");
}
public function addTitle($template){
return "this is a test...";
}
}
$page = new Index();
If you want to access the addTitle function from your back end add the become tag (You can change this tag on the configuration file also the default folder where the htmls needs to be placed) to your html:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<body>
<h1><become method="addTitle"></become></h1>
</body>
</html>
If you want to minify your JavaScript code call the following function on your html:
<become method="bundleFiles">
<script type="text/javascript" src="javascript/com/image.js"></script>
</become>