Ways to avoid smarty conflicts with CSS syntax, smartycss syntax conflicts _php Tutorial

Source: Internet
Author: User

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

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