Loading Please wait...
Views are Simple HTML Files with Embebdded PHP Codes in It like the following
<div id="studentInfoBox" class="infoBox">
<span>Name: </span> <?= $name ?>
<span>Department: </span><?= $deptName ?>
</div>
- See also:
- Embedding is done through Embed Class
All types of views are HTML files with PHP Codes embedded in it. General Views belong to a method of a Controller. and
shared views belong to a project so
shared accros different controller. general views are stored into apps/view/controllerName/methodName directory in your project directory.
shared Views stays in usr/share/vuew Directory in yoru project directory. all view files have an extension .view.php all of these views are written in teh same way (HTML Tags and Embedded PHP code).
a View has variables as embedded PHP Code's Blocks and when a controler uses that View it '''supplies''' Values of those variables somehow. However a view has no headeche on how the variables is passed. the will get the variable's values through the controller.
To read more [[Controller::Different_Types_of_Views|See controller]].
the above shown View works as a Single View Unit. However you can embed one View in another. Just like the following one.
<div id="studentInfoBox" class="infoBox">
<span>Name: </span> <?= $name ?>
<? Embed::loadable('dept', array('deptName' => $deptName)) ?>
</div>
and create another View called dept.view.php in the same method's directory.
<span>Department: </span><?= $deptName ?>
Nesting of View Embedding is also possible
there are 4 functions to Embedd a View into another.
- See also:
- Main article on Embed::renderable
accept two arguments render a View and embed its output content. first argument is the viewName remember it renders a View under the current method. You can optionally specify a source Object who's member variables will become the local variables of the embedded View
- See also:
- Main article on Embed::loadable
accept two arguments load a View and embed its output content. first argument is the viewName remember it loads a View under the current method. You can optionally specify a source associative who's keys will become the local variables of the embedded View
- See also:
- Main article on Embed::sharedRenderable
accept two arguments render a View and embed its output content. first argument is the viewName remember it renders a
shared View under the current project. You can optionally specify a source Object who's member variables will become the local variables of the embedded View
- See also:
- Main article on Embed::sharedLoadable
accept two arguments load a View and embed its output content. first argument is the viewName remember it loads a
shared View under the current project. You can optionally specify a source associative who's keys will become the local variables of the embedded View