I've a html page with php smarty tags.
The problem is the {literal}
tags, needed to escape javascript and css code block.
In many others php versions, like php 5.3 or 5.5 works fine, but in php 5.4.9 doesn't work
When i use {literal}
to escape javascript, like below:
<script type="text/javascript">
{literal}
$(function () {
jQuery.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) jQuery.support.placeholder = true;
if (!$.support.placeholder) {
$('.field').find ('label').show ();
}
});
{/literal}
</script>
I get a "Fatal error: Smarty error: [in login.html line 70]: syntax error: unrecognized tag: php' . str_repeat(" ", substr_count('{literal (Smarty_Compiler.class.php, line 446) in /var/www/library/smarty/Smarty.class.php on line 1095"
and the line 70 is the code {literal}
.
But if i remove {literal}
tags and use {ldelim}
and {rdelim}
this works fine, like:
<script type="text/javascript">
$(function () {ldelim}
jQuery.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) jQuery.support.placeholder = true;
if (!$.support.placeholder) {ldelim}
$('.field').find ('label').show ();
{rdelim}
{rdelim});
</script>
I do not consider as a solution change all tags {literal}
in the project for {ldelim}
and {rdelim}
, when i have the same project working fine in others php versions and when i have lot of pages escaping javascript's and css with {literal}
.