This article mainly introduces the PHP Smarty delimiter conflict How to deal with, interested in the friend's reference, I hope to help you.
The default delimiter "{" conflicts with the "{" in CSS and JS, what should I do with it?1. All the places
test.phpPHP//define the path where the page cache file is stored$filename= ".. /cache/cachetest.html ";//Defining cache validity periods$cachetime= 5;//determine if the cache file existsif(!file_exists($filename) ||Filemtime($filename)+$cachetime
There is no way to return a page as a string when using $smarty->display (). View Smarty Source Discovery display is actually called the $smarty->fetch (), found a $diaplay parameter, true when printing the page, False when the return string. Direct
Configuration file for Smarty templatesPHPDefine("ROOT",Str_replace("\\","/",dirname(__file__)).‘ /‘);//constant root Specifies the project root directoryrequireROOT. ' Smarty/smarty.class.php ';//loading the Smarty class file$smarty=NewSmarty
PHP smarty Template Error on-line solution!
PHP smarty Template error, is not smarty template things are to be installed first, I directly to the source code to configure the environment of the machine on the above problem, in the original machine
PHP smarty foreach name index first last etc.
Index example
{* The header block is output every five rows *}
{* Output one header chunk per five lines *}
{foreach from= $items key=myid item=i Name=foo} {if $smarty.
PHP Smarty Cache usage
First, use the cache?To turn on the Smarty cache, simply set caching to True and specify Cache_dir.Use Cache_lefetime to specify the cache lifetime in secondsTo generate multiple different caches for the same page,
php-smarty-Cache 2 (26)
A page, some data cache, some data is not cached, is the local cache
L $smarty->assign ("var", "value", true)
Third parameter: Indicates whether to not cache
L {$var Nocache=true}
Use the NoCache parameter after the template
php-smarty-Cache 1 (25)
First, the principle of caching:
IE: Saving a resource file to a local
Smarty: Saving the cache to the server
Compile
Second, why the use of caching technology
1. Improve website access speed
2. Reduce Web server pressure
3,
PHP smarty Basic syntax and three major variables
In the Smarty template is mainly based on variables, the following is about smarty three variables and some common usage
First build the file you want to use in the root directory the same as the
In this paper, we describe the method of implementing multi-template website in PHP smarty. Share to everyone for your reference. The implementation method is as follows:
Template model1.htm Code:
Template 1 Template 1 | Template 2 |
Php + smarty batch generate static files using php + smary to simulate dedecms background?> "Update all documents. In particular, it is easy to write because it is tested on the local machine to see the implemented functions. Of course, I am also a
PHP/*First, what is Smarty?smarty is a php template used to write a template engine, it provides a separation of logic and external content, in brief, the purpose is to use a PHP programmer with the art separation, the use of programmers to change
Simple php smarty entry program instance
First, you must have three folders: configs, templates, and templates_c. In the configs folder, there is a configuration file: test. conf. The Code is as follows:
1 2 3 4
Title = Welcome
Smarty Function---plug-in1) built-in function sysplugins does not allow modification2) Custom Function plugins can be modified1. Capture captures a piece of content, but does not outputGrammar:{Capture name= ' var '}Content{/capture}Name: Save the
First, comments
* Note content *
HTML comments are displayed in the client source file
Smarty comments are not sent to the client
Smarty's comments are mainly for the template designer to see
Second, the variables in the template
L is assigned by
Smarty Function---plug-in
1) built-in function sysplugins does not allow modification
2) Custom Function plugins can be modified
1. Capture captures a piece of content, but does not output
Grammar:
{Capture name= ' var '}
Content
{/capture}
Name:
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.