예제 #1
0
 /**
  * @covers ::buildBuilder
  * @covers ::<protected>
  */
 public function testBuildBuilder()
 {
     $template = new \PHPixie\Template($this->slice, $this->filesystemLocator, $this->configData, $this->filesystemRoot, $this->externalExtensions, $this->externalFormats);
     $this->assertInstance($template->builder(), '\\PHPixie\\Template\\Builder', array('slice' => $this->slice, 'filesystemLocator' => $this->filesystemLocator, 'configData' => $this->configData, 'filesystemRoot' => $this->filesystemRoot, 'externalExtensions' => $this->externalExtensions, 'externalFormats' => $this->externalFormats));
     $template = new \PHPixie\Template($this->slice, $this->filesystemLocator, $this->configData);
     $this->assertInstance($template->builder(), '\\PHPixie\\Template\\Builder', array('slice' => $this->slice, 'filesystemLocator' => $this->filesystemLocator, 'configData' => $this->configData, 'filesystemRoot' => null, 'externalExtensions' => array(), 'externalFormats' => array()));
 }
예제 #2
0
<?php

require_once 'vendor/autoload.php';
//Required libraries
$slice = new \PHPixie\Slice();
$filesystem = new \PHPixie\Filesystem();
//Configuration
$locatorConfig = $slice->arrayData(array('directory' => '/templates/'));
$templateConfig = $slice->arrayData(array());
//Build dependencies
$root = $filesystem->root(__DIR__);
$locator = $filesystem->buildlocator($locatorConfig, $root);
//And the Template library itself
$template = new \PHPixie\Template($slice, $locator, $templateConfig);
echo $template->render('fairy', array('name' => 'Stella'));
$fairy = $template->get('fairy');
$fairy->name = 'Blum';
echo $fairy->render();