Working with Addons/Modules/Views

Creating view files for addons and modules

Views are not defined as objects but are just regular text or html and php code aimed at displaying some results. In the case of an http mode application, the view will typically produce a full html page or some valid code that can be inserted in a page. In the case of a cli mode application, the view will merely display some text (colored if your console supports it).

Each addon can have an unlimited number of view files.

As for the other component of the addon, views can be defined at the framework or application level.
For example:

show_articles.view.php <div> <?php foreach($this->articles as $article) { ?> <p class="article_subject"><?=$article['name'];?></p> <?php } ?> </div>

Modules may also have their own views.
in our example the files are located in:


either at the framework or at the application level.

Another option is to keep all the view files together and have for example:

.../addons/articles/views/show_articles.view.php .../addons/articles/views/frontend/vote_article.view.php .../addons/articles/views/backend/article_edit_form.view.php