webCOMAND

io_comand_mvc\view

A class to load and process cMVC views, which are simple PHP files that serve as templates.

View templates are simple PHP files placed in a views/ folder that contain text and/or PHP code that reference an expected set of variables, which are passed to the view by the controller.  Short PHP tags and alternative syntax for control structures are typically used to improve readability, but not required.

Views are typically accessed through a controller's view method, but the render static method can also be called directly on a file.

View Example

<!-- File: packages/com_example_www/views/contacts.php -->
<?php foreach($contacts as $c): ?>
<div class="contact">
    <h2><?= $c->FirstName . ' ' . $c->LastName ?></h2>
    <p><?= $c->Summary ?></p>
</div>
<?php endforeach; ?>