Loading Please wait...

View Embedding

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
view.png

General and Shared Views

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).

Rendering and Loading Views

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]].

Embeding Views

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.

Embed::renderable()

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

Embed::loadable()

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

Embed::sharedRenderable()

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

Embed::sharedLoadable()

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

Generated on Mon Oct 27 23:51:59 2008 for zigmoyd.kdevelop by doxygen 1.5.6