Then there's the View folder, which is at the root of the local gfx application and is called "views". This one contains php files named under the following syntax:


Each view has the php final extension but can contain both php and standard templating code like pure html, css, js. In fact, a view should contain exaclty the code needed to display data to the user in the desired way. This will be achieved by a particular interaction that we'll see later in this guide.

You can also create a views hierarchy simply by creating a set of folders. The load process will be completely transparent for the engine, and it's done by simply putting the entire url starting from "views" in the load command. This will be seen in a pratical example later.

When inside a controller you can just load a view by calling:

EStructure::view($view_path, [$params]) $view_path is the URI of the yourname.views.php starting from the "views" local folder of your website and without "views.php" part of the filename. [$params] is a list of parameters that the view will receive in the $data array. You can also load other components of your website (controllers and views) inside a view simply by using EStructure::view() and EStructure::controller(). Check Controller for info. Short example of loading a view that resides in views/menu/adminpanel.views.php passing some data.

$name = 'Claudio';
$surname = 'Desideri';
EStructure::view('menu/adminpanel', $name, $surname);

Content of views/menu/adminpanel.views.php:

    <?php EStructure::controller('user', 'show'); ?>
    My name is <?=data[0]?>.
    My surname is <?=data[1]?>.

We're working on changing the way of passing variables to views since $data seems to be confusing and messy so this can be changed in the near future.

This page was last edited on 27 July 2015, at 21:08. Content is available under Creative Commons License SA 4.0 unless otherwise noted.