View refers to part of the application that is responsible for UI. This consists of View Page Parts, CSS files, JS files, and also graphics and multimedia assets of the application. Code for View Page Parts, CSS files and JS files can be created and managed directly through the Batoi Framework IDE. However, you can also edit these files in your favourite code editor too.
View Page Parts (VPP) are files which contain UI content consisting of HTML and PHP print statements or simple loops and conditions. They are called Page Parts as one or more such file will create a complete UI that goes to client-side for rendering. These are defined on the Batoi Framework IDE while creating or editing events and are available as
$APP->VIEWPARTS within the application. The content of VPP can be created and managed directly through the Batoi Framework IDE. However, you can also edit these files in your favourite code editor. For example, there are three VPPs which make UI in the default event of
index.php Controller (when Batoi Framework is installed, these are created to start with):
View page Parts are connected to an event on the event definition page on the Batoi Framework IDE. In many cases, VPPs are optional, particularly in AJAX requests from UI. In such cases, the data arrays received from Model are returned directly without calling View. Sometimes, one or more VPPs are required even in AJAX calls.
View Page Variables (VPV) are required to define UI pages. This includes page title (
$APP->PAGEVARS[TITLE]), page h1 texts (
$APP->PAGEVARS[HEADERTEXT]), page breadcrumb (
$APP->PAGEVARS[BREADCRUMB]), etc. While the specified three are automatically created when you install the Batoi Framework, any other (as required in the scope of your application) can be created on the Batoi Framework IDE and be used within the application. You can also include PHP variables within the VPV definition if required.