Skip to content

flextype-components/view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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