The examples in this article describe ways to avoid smarty conflicts with CSS syntax. Share to everyone for your reference. The specific analysis is as follows:
People who are familiar with CSS will soon find that there is a conflict between the syntax of Smarty and CSS, because both need to use braces {}. If you simply embed CSS markup into the HTML document header, you will cause an "unrecognized markup" error:
Don't worry, because we have 3 solutions.
First, use the link tag to extract style information from another file:
Second, use the smarty literal tag to surround style sheet information
These tags tell smarty not to parse any content within the tag:
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= ';
...
? >
Although 3 solutions can solve the problem, the first one is probably the most convenient because it is a common practice to put CSS in a separate file. In addition, this solution does not require modifying the important default configuration (delimiters) of the smarty.
I hope this article will help you with your PHP program design.