By default, at the end of execution of the controller action and (if different) render controller's render action, the view for the render action is displayed using the default layout. Fabriq can be instructed to render the display of the view in the selected layout (automatically set to default by the framework), just the view (often used for AJAX return data), or no display at all. The display information of the view is stored in the /app/views/[controller name]/ directory and given the name [action name].view.php (ex: /app/views/users/login.view.php).
If you would like to render the view with a layout other than the default layout, it can be set inside of the controller's action function that corresponds to the view by calling Fabriq::layout() and passing in a layout name (ex: Fabriq::layout('myaccount');). Layout files are stored in the /app/views/layouts directory of the application (ex: /app/views/layouts/myaccount.view.php).
The information that is displayed can be set to one of three options using the Fabriq::render() function inside of the controller's action function that corresponds to the view:
- layout
- view
- none
The layout option displays the view wrapped in the selected layout file (the default if no other is specified in the controller's action function). The view option displays only the information displayed by the view. The view option is recommended for data returned by AJAX such as JSON or XML (be sure to set the content's MIME type before rendering anything if using a return type other than HTML). Using none renders no information out to the browser.
NOTE:
