Resolving conflicts with Css/json in the PHP regular template engine

Source: Internet
Author: User

Main target: Smarty/dwoo

Reference: http://developer.51cto.com/art/201009/224929.htm

In fact, not much attention to the template engine, feel no need to use. But as the age increases, code cleanliness becomes more and more serious, only to begin to encounter this problem.

There is a conflict between the syntax of Smarty and CSS/JS because both require curly braces {}. Although you can change the smarty, it is not a good deal to modify all the relevant code in an existing system.

1. Avoid simultaneous occurrences

avoided by means of external references. The problem is to avoid being shunned. So this situation is only suitable for a small number of simple cases.

2. Modifying the Smarty delimiter

2. Surround style sheet information with smarty literal tags

<script type= "Text/javascript" >      function goods_show (ID) {

<!--{literal}-->

Art.dialog.open (url,{id: ' select ', title: ': ', width:760,height:380,padding: ' 10px '});

<!--{/literal}--> }</script>

Resolving conflicts with Css/json in the PHP regular template engine

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.