Escape PHP tags '<? ?>' on HTML Comments <!-- //-->
<!--
<?xml version="1.0" encoding="utf-8"?>
//-->
It will render as is, so having a problem regarding the generated PHP code because the <? ?>
Parse error: syntax error, unexpected T_STRING in ...
but since tal expessions are *not* evaluated inside comments i can't process it with a tal expression.
Shouldn't be the right behaviour to escape such characters when they are inside an html comment ?
I was thinking on implementing something like this on phptal for such case:
echo <<<uuid
<!--
<? blah blah ?>
//-->
uuid;
Waiting for comments ...
Slds.
-- Nestor A. Diaz Ingeniero de Sistemas Tel. +57 1-485-3020 x 211 Cel. +57 316-227-3593 Tel. SIP: sip:211-NS/jz+eG3AXzfdHfmsDf5w@public.gmane.org Email/MSN: nestor-NS/jz+eG3AXzfdHfmsDf5w@public.gmane.org http://www.tiendalinux.com/ Bogota, Colombia
_______________________________________________ PHPTAL mailing list PHPTAL@... http://lists.motion-twin.com/mailman/listinfo/phptal
The syntax:
"eq:" [ " " expr ]*
These are some examples:
eq: data/value string:3
Compares data/value with "3"
eq: data/value string:3 data/value2 string:5
Compares data/value with "3" and data/value2 with "5"
eq: data/value data/value2 string:6
Compares both data/value and data/value2 with "6"
One caveat: due to the simplistic parsing I'm doing you can't have
spaces in the string: literals.
Another one: it uses closures, so it would break in < 5.3.0
Here's the function:
function phptal_tales_eq($src, $nothrow)
{
return join('&&', array_map(function($chunk) {
static $last = false;
if (!isset($chunk[1])) {
$chunk[1] = $last;
} elseif ($last === false) {
$last = $chunk[1];
}
return join('==', $chunk);
}, array_chunk(array_map(function($path) use ($nothrow) {
return phptal_tales($path, $nothrow);
}, explode(' ', trim($src))), 2)));
}
RSS Feed