Sha256: a6de305c6d82913528ad33cd0afa36f84c700da0be0611a95fe620361ecbc648

Contents?: true

Size: 738 Bytes

Versions: 10

Compression:

Stored size: 738 Bytes

Contents

<?php
/**
 * This example shows how to integrate MtHaml with PHP templates.
 */

require __DIR__ . "/autoload.php";

$haml = new MtHaml\Environment('php');
$hamlExecutor = new MtHaml\Support\Php\Executor($haml, array(
    'cache' => sys_get_temp_dir().'/haml',
));

/*
 * Execute the template
 */

echo "\n\nExecuted Template:\n\n";

$template = __DIR__ . '/example-php.haml';
$variables = array(
    'foo' => 'bar',
);

try {
    $hamlExecutor->display($template, $variables);
} catch (MtHaml\Exception $e) {
    echo "Failed to execute template: ", $e->getMessage(), "\n";
}

/*
 * See how it was compiled
 */ 
 
echo "\n\nHow the template was compiled:\n\n";

echo $haml->compileString(file_get_contents($template), $template), "\n";

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
guard-mthaml-0.4.0 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.3.1 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.3.0 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.2.5 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.2.4 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.2.3 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.2.2 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.2.1 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.2.0 vendor/mthaml/mthaml/examples/example-php.php
guard-mthaml-0.1.0 vendor/mthaml/mthaml/examples/example-php.php