Skip to content

Instantly share code, notes, and snippets.

@harikt
Created April 18, 2012 18:48
Show Gist options
  • Select an option

  • Save harikt/2415734 to your computer and use it in GitHub Desktop.

Select an option

Save harikt/2415734 to your computer and use it in GitHub Desktop.
Sample with Aura View Escaper Branch
<?php
$package_dir = dirname( __DIR__ ) . '/aurasystem/package';
$template = require_once $package_dir . '/Aura.View/scripts/instance.php';
// require_once $package_dir . '/Aura.Cli/src.php';
$template->var = 'Hello World';
$escaper = new stdclass();
$escaper->c = 'x';
$escaper->c .= ' > ';
$escaper->c .= ' 2 ';
$escaper1['b'] = 'x';
$escaper1['b'] .= ' > ';
$escaper1['b'] .= ' 2 ';
$template->addData([
'hello' => 'this & that',
'world' => 'Hurray world',
'h1' => ' x > 2 ',
'h2' => ' y < 3 ',
'h3' => $escaper->c,
'h4' => $escaper1['b']
]);
echo $template->fetch('hello.php');
// Template file hello.php
Hello Sample
<?php echo $this->var . PHP_EOL; ?>
<?php echo $this->hello . PHP_EOL; ?>
<?php echo $this->world . PHP_EOL; ?>
<?php
$escaper['b'] = 'x';
$escaper['b'] .= ' > ';
$escaper['b'] .= '2';
echo $escaper['b'] . PHP_EOL;
$escaper1 = new Stdclass();
$escaper1->c = 'x';
$escaper1->c .= '>';
$escaper1->c .= '2';
echo $escaper1->c . PHP_EOL;
echo 'h1 ' . $this->h1 . PHP_EOL;
echo 'h2 ' . $this->h2 . PHP_EOL;
echo 'h3 ' . $this->h3 . PHP_EOL;
echo 'h4 ' . $this->h4 . PHP_EOL;
@harikt
Copy link
Copy Markdown
Author

harikt commented Apr 18, 2012

Output :

Hello Sample 
Hello World
this &amp; that
Hurray world
x > 2
x>2
h1  x &gt; 2 
h2  y &lt; 3 
h3 x &gt;  2 
h4 x &gt;  2 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment