How is my smarty configuration?-php Tutorial

Source: Internet
Author: User
The directory structure of my smarty configuration is as follows: smarty_pro1 & nbsp; --- libs & nbsp; --- config & nbsp; --- templates (here I put one, index. tpl) & nbsp; --- templates_c & what's wrong with my smarty configuration?
The directory structure is as follows: smarty_pro1
--- Libs
--- Config
--- Templates (here, index. tpl)
--- Templates_c
--- Cache
Index. php

The content in index. php is
Define ('smarty _ path', '../smarty_pro1 /');
Include_once (SMARTY_PATH. 'libs/Smarty. class. php ');

$ Smarty = new Smarty ();

$ Smarty-> template_dir = SMARTY_PATH. 'Templates /';
$ Smarty-> compile_dir = SMARTY_PATH. 'Templates _ c /';
$ Smarty-> config_dir = SMARTY_PATH. 'configs /';
$ Smarty-> cache_dir = SMARTY_PATH. 'cache /';

$ Smarty-> left_delimiter = '{';
$ Smarty-> right_delimiter = '}';
$ Smarty-> assign ('title', 'Test ');
$ Smarty-> assign ('content', 'Content ');
$ Smarty-> display ('index. tpl ');


?>

Index. tpl content is





{$ Title}



{$ Content}



Why are there no values for the two variables in the result? I haven't done well for a long time. what is the problem?

------ Solution --------------------
PHP code
$ Smarty-> left_delimiter = '{'; // pay attention to the space in the quotation marks $ smarty-> right_delimiter = '}'; // pay attention to the space in the quotation marks
------ Solution --------------------
Discussion
PHP code
$ Smarty-> left_delimiter = '{'; // pay attention to spaces in quotation marks.
$ Smarty-> right_delimiter = '}'; // pay attention to spaces in quotation marks


If you really like to add spaces in {}, please tell smarty your habits!

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.