Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 1.25 KB

README.md

File metadata and controls

58 lines (44 loc) · 1.25 KB

View Component

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