Home >Web Front-end >JS Tutorial >Two ways to solve the conflict between {} and smarty delimiters in css and js_javascript skills

Two ways to solve the conflict between {} and smarty delimiters in css and js_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:22:571184browse

When the url address is entered, the web page appears: Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "E:wampwwwcmssystem/templates/index.html" on line 79 "$("#job").load(". /system/templates/touch/test.php",{catid:3});" - Unexpected ":", expected one of: "}" , " "' in E:wampwwwcmssystemSmartyssyspluginssmarty_internal_templatecompilerbase.php on line 441 Such a problem, It is usually caused by the conflict between {} and smarty delimiters in css and js.

There are two solutions:

1. You can set the smarty delimiter to <{ }>

Copy code The code is as follows:

$tpl->left_delimiter = '<{';
$tpl-> right_delimiter = '}>';

2. For the conflict between js's {} and smarty's delimiter, you can use smarty's literal to handle it, and you can include the JS code in {literal}{/literal } will do.
Copy code The code is as follows:

<{literal}>
$ (
function () { alert ('training course')}
);
<{/literal}>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn