Home >Backend Development >PHP Tutorial >Methods to avoid syntax conflicts between Smarty and CSS_PHP Tutorial
The example in this article describes how to avoid syntax conflicts between Smarty and CSS. Share it with everyone for your reference. The specific analysis is as follows:
Those who are familiar with CSS will quickly find that there is a syntax conflict between Smarty and CSS, because both require the use of curly brackets {}. Simply embedding CSS tags into the header of an HTML document will result in an "unrecognized tag" error:
?
3 4 5
6
7
10
|
|
1 2 3 4 5 6 |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
1 2 3 4 5 6 7 | <🎜>require("Smarty.class.php");<🎜> <🎜>$smarty=newSmarty;<🎜> <🎜>$smarty->left_delimiter=''; $smarty->right_delimiter=''; ... ?> |
While all 3 solutions will solve the problem, the first of them is probably the most convenient since putting CSS in a separate file is a common practice. Furthermore, this solution does not require modification of Smarty's important default configuration (delimiters).
I hope this article will be helpful to everyone’s PHP programming design.