2017 © Pedro Peláez
 

library templating

Avalon Templating Component.

image

avalon/templating

Avalon Templating Component.

  • Wednesday, July 6, 2016
  • by Nirix
  • Repository
  • 2 Watchers
  • 0 Stars
  • 848 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Avalon - Templating Package

Fast and easy templating., (*1)

Installation

This package can be installed via composer:, (*2)

composer require avalon/templating

Engines

There are two templating engines available for use:, (*3)

PHP

Basically the same as include 'myfile.php'; but returns the rendered view as opposed to straight up outputting it., (*4)

PHP Extended

Allows for extending other views and defining content blocks., (*5)

<!-- layouts/default.phtml -->
<h1>My Layout</h1>
<?=$this->getSection('content')?>

extend('layouts/default.phtml'); ?>

startSection('pageTitle', 'My Page'); ?>

startSection('content'); ?>
View content here
endSection(); ?>

Usage

This example uses the PHP Extended engine., (*6)

use Avalon\Templating\View;
use Avalon\Templating\View\Engines\PhpExtended;

// Instantiate the engine
$engine = new PhpExtended;

// Set it as the engine for the `View` singleton to use.
View::setEngine($engine);

// Add some paths to search for views in
View::addPath('/path/to/views/directory');
View::addPath('/path/to/another/views/directory');

// Render a view
View::render('my_view.phtml');

// Variables can also be passed to views like so:
View::render('my_view.phtml', ['variableName' => 'Variable value']);

The Versions

06/07 2016

dev-master

9999999-dev

Avalon Templating Component.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

by Avatar Nirix

avalon framework templating