Smarty appeared uncaught exception smartycompilerexception

Source: Internet
Author: User

This is usually because of the smarty boundary character other program conflicts, at which point the solution has three

1. External chain related documents. such as the CCS style sheet, the link outside the chain cascading style sheet files. For example:


1 <link href= "style.css" type= "Text/css" rel= "stylesheet"/>


2. Use the literal tag. Using Smarty's unique literal tag to differentiate between areas that do not need to be resolved, the area Smarty that is included with the tag {literal} and {/literal} will skip parsing direct output, which will not result in a conflict.

The code is as follows Copy Code

{literal}
<style type= "Text/css" >
Body {
Color: #FFF;
}
</style>
{/literal}


3. Modify the default delimiter for Smarty. This is done by setting the Left_delimiter and Right_delimiter properties.

The code is as follows Copy Code
Require ("Smarty.class.php");
$template = new Smarty;
$template->left_delimiter = ' <{';
$template->right_delimiter = '}> ';

The disadvantage of the 3rd method is to change the original template parsing label, more trouble, recommend the 1th and the 2nd flexible combination of use.

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.