Two methods to solve the conflict between CSS and JS {} and Smarty delimiters _javascript skills

Source: Internet
Author: User
The page appears when the URL address is entered: Fatal error:uncaught exception ' smartycompilerexception ' with message ' Syntax error in template ' E:\wamp\w Ww\cms\system/templates/index.html "On line" $ ("#job"). Load ("./system/templates/touch/test.php", {catid:3}); "- Unexpected ":", expected one of: "}", "" ' in E:\wamp\www\cms\system\Smarty\sysplugins\smarty_internal_ Templatecompilerbase.php on line 441 is usually caused by CSS and JS {} and Smarty delimiter conflicts.

There are two solutions:

1. The Smarty delimiter can be set to <{}>
Copy Code code as follows:

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

2. For JS {} and Smarty delimiter conflict, you can use smarty literal processing, can be included in the JS code in {literal}{/literal} can be.
Copy Code code as follows:

<{literal}>
$ (
<span style= "White-space:pre" > </span>function () {Alert (' Training Course ')}
);
<{/literal}>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.