This article mainly introduces the PHP Smarty delimiter conflict How to deal with, interested in the friend's reference, I hope to help you.
The default delimiter "{" conflicts with the "{" in CSS and JS, what should I do with it?
1. All the places starting with {are empty. (Smarty only parses the contents of the delimiter and cannot have spaces after the left delimiter)
2. The CSS and JS are introduced in an external way. (Smarty does not parse external files)
3. Use the built-in function literal.
4. Change the delimiter.
The best way to resolve conflicts: external introduction of CSS and JS, for internal use of literal.
index.php (back end):
<?php //1. Introduction of Smarty class include ' libs/smarty.class.php '; 2. Instantiate the Smarty object $smarty = new Smarty (); 3. Set related properties $smarty->template_dir = "templates/";//Template directory $smarty->compile_dir = "Templates_c";//Compile Directory //Modify delimiter $smarty->left_delimiter = ' <{'; Custom delimiter, default is "{" $smarty->right_delimiter = '}> '; 4. Assigning Data $smarty->assign (' title ', ' Smarty template engine '); $smarty->assign (' content ', ' smarty template engine is a powerful template engine! '); 5. Load View $smarty->display (' index.html ');
Index.html (front-end view):
<! DOCTYPE html>