phphaml
phphaml copied to clipboard
Ruby string interpolation, double equals (==)
In Haml a double equals interpolates a string the same way that a single equals interpolates ruby code, although the doc itself is quite quiet about that. So this
- @student = 'derDoc'
%p= "Hello #{@student}"
produces the same result as
%p== Hello #{@student}
produces:
<p>Hello derDoc</p>
produces the same result as
<p>Hello derDoc</p>
The same (with php vars) run through phphaml however, produces this:
<?php $student = 'derDoc';?><p<?php $this->writeAttributes(array (), array($student)); ?>><?php echo "Hello #"; ?>
</p>
produces the same result as
<p<?php $this->writeAttributes(array (), array($student)); ?>><?php echo Hello #; ?>
</p>
In case it wasn't clear, I don't use PHPHaml any more and am quite willing to cede maintainership of it, for example to Baldrs (https://github.com/Baldrs/phphaml).
Oh... ok! You should put a notice in the readme and a link, maybe. Included it in my tests, though it doesnt compile more than yours, some more are logically correct now ;)