Avoid smarty conflicts with CSS syntax, smartycss syntax conflicts
The examples in this article describe ways to avoid conflicts between Smarty and CSS syntax. Share to everyone for your reference. The specific analysis is as follows:
People familiar with CSS will soon find that Smarty and CSS have conflicting syntax because both require braces {}. If you simply embed a CSS tag in the HTML document header, it will cause an "unrecognized tag" error:
{$title}
Don't worry, because we have 3 solutions.
First, use the link tag to extract style information from another file:
{$title}
...
Second, use the literal tag of smarty to enclose the style sheet information.
These tokens tell Smarty not to parse anything inside the tag:
{$title}{/literal} ...
Third, modify the default delimiter for Smarty
You can do this by setting the Center_delimiter and Center_delimiter properties:
<?php require ("Smarty.class.php"); $smarty =newsmarty; $smarty->left_delimiter= '; $smarty->right_delimiter= '; ... ? >
While 3 solutions solve the problem, the first of these may be the most convenient, because putting CSS in a separate file is a common practice. In addition, this solution does not need to modify the important default configuration (delimiter) of Smarty.
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/963126.html www.bkjia.com true http://www.bkjia.com/PHPjc/963126.html techarticle avoid smarty and CSS syntax conflict method, SMARTYCSS syntax Conflict This article describes a method to avoid smarty and CSS syntax conflicts. Share to everyone for your reference. The specific analysis is as follows: ...