You are here

public function HamlParser::haml2PHP in Sassy 7

* Parses a Haml file into PHP. *

Parameters

string path to file to parse: * @return string the resulting PHP

1 call to HamlParser::haml2PHP()
HamlParser::parse in phamlp/haml/HamlParser.php
* Parses a Haml file. * If an output directory is given the resulting PHP is cached. *

File

phamlp/haml/HamlParser.php, line 434

Class

HamlParser
HamlParser class. Parses {@link http://haml-lang.com/ Haml} view files. @package PHamlP @subpackage Haml

Code

public function haml2PHP($sourceFile) {
  $this->line = 0;
  $this->filename = $sourceFile;
  $helpers = "<?php\nrequire_once '" . dirname(__FILE__) . DIRECTORY_SEPARATOR . "HamlHelpers.php';\n";
  if (isset($this->helperFile)) {
    $helpers .= "require_once '{$this->helperFile}';\n";
  }
  $helpers .= "?>";
  return $helpers . $this
    ->toTree(file_get_contents($sourceFile))
    ->render();
}