View Component provides basic methods for displaying PHP views.

v1.1.1 2018-04-30 13:44 UTC

This package is auto-updated.

Last update: 2024-12-25 10:26:52 UTC


README

version MIT License

View Component provides basic methods for displaying PHP views.

Installation

composer require flextype-components/View

Usage

use Flextype\Component\View\View;

Create a new view object and render it.

// Create new view object
$view = new View('blog/views/backend/index');

// Assign some new variables
$view->assign('msg', 'Some message...');

// Get view
$output = $view->render();

// Display view
echo $output;

View factory
Create new view object, assign some variables and displays the rendered view in the browser.

View::factory('blog/views/backend/index')
     ->assign('msg', 'Some message...')
     ->display();

Include the view file and extracts the view variables before returning the generated output.

// Get view
$output = $view->render();

// Display output
echo $output;

Displays the rendered view in the browser.

$view->display();

License

See LICENSE