Css/json conflict Resolution in PHP regular template engine, cssjson_php tutorial

Source: Internet
Author: User
Tags php framework

Css/json conflict Resolution in PHP regular template engine, Cssjson


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

  <   html  ;   <   head     <,   title  ,  {$title} !--  title  ;   {literal}   <   Styletypestyletype   = "Text/css"  ;   P    {  margin  :  : 2px  }  !--  style  ;   {/literal}  !--  Head  ;     
<type= "Text/javascript">      function  goods_show (ID ){



Art.dialog.open (url,{id:'select', title:' of: ' , Width: 760 , Height: 380 '10px'});

} script>

The third is undoubtedly green, in the face of conflict, plus literal tag package.

The program works equally well for Dwoo engines.


PHP framework and template engine is a matter of

About the framework you can understand that, like the foundation of a building, no matter how the building is built, the method of building the foundation is always similar.

In our program development process, you will find that each program has a lot of similar things and reusable things, if you after each project to accumulate these similar things, then the code can be called a library, when the library is more and more powerful, even the program structure can be reused, You can call him a frame.

The domestic relatively good framework has thinkphp, fleaphp, foreign zendframework and Symfony. If the landlord would like to rely on PHP to find work advice to learn zendframework, if the personal development recommends the use of symfony.

About the template engine, you can understand into the construction team paint, they are professional brush paint, cover the building without tube paint how to brush, brush paint is not concerned about how the building is covered.

In fact, the main role of the template engine is to separate the logic and display, initially may be to allow programmers and artists to better cooperate, since the beginner, I think you will often write PHP code and HTML together, you can understand, but the art does not necessarily understand, They may only be able to read HTML and CSS, and also say that if the artist in the mixed code add complex CSS or JS you will not understand, so that the development of the program has brought great difficulties. So there is a template engine, it will be completely separate logic and display, the programmer only need to focus on logic, at the end of the program to prepare the data and then passed to the template, and the artist just modify the template without the need to consider the program logic, template technology in team development is often used, it is recommended that you learn smarty.

Do not know whether to speak thoroughly, have not understood can add.

PHP dynamically generates HTML tags and CSS issues

Echo '

Im create by PHP </p> '
?>

What is the HTML structure after compiling? CSS is run on the client, so when you find that the style is wrong, you view the source file, save as HTML to check, see what is different, if you are Ajax do, the source file does not have the corresponding structure, then open the Firebug copy code to generate HTML and then check!

In short, to check the CSS, please do not stare at the program, put in the client HTML environment to test it!

http://www.bkjia.com/PHPjc/864309.html www.bkjia.com true http://www.bkjia.com/PHPjc/864309.html techarticle The Css/json conflict resolution in the PHP regular template engine, Cssjson mainly targets: Smarty/dwoo reference: http://developer.51cto.com/art/201009/224929.htm In fact , not much attention before ...

  • 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.