Package download
pain.php
Copy Code code as follows:
Class Pain
{
Public $var =array ();
Public $tpl =array ();
This is the assign VARs to the template
Public function assign ($variable, $value =null)
{
$this->var[$variable]=
The logical layer and presentation layer of the MVC development pattern in PHP has a variety of template engines to choose from, but when the official engine Smarty is born, the choice changes. Its idea and realization are quite "avantgarde". This
JTemplate. class. php
001002/**003* @ author Jiawei004* @ Completed in005*/006Class JTemplate {007// The variables passed in through the assign function temporarily store Arrays008Private $ templateVar = array ();009// Template directory010Private
PHP is the world's smallest and simplest template engine ------ Pain (normal version). Unlike smarty, all variables are included in the {@}, which helps you understand the template engine. Package download
Pain. php
The code is as follows:
Class
Assume that the tag format is used as the template syntax. In the parsing process, I think of two implementation methods: 1. obtain the TAG content using regular expressions, replace the tags with regular expressions, and use eval for parsing. After
For more information about the target objects: SmartyDwoo, see. 51cto.comart201009224929.htm. In fact, I didn't pay much attention to the template engine in the past and thought it was unnecessary to use it. But with the increase of age, code
1. Enable and use the smarty Cache
To enable the smarty cache, you only need to set caching to true in the smarty Setting Parameter and specify cache_dir. Set the cache_lefetime parameter to specify the cache survival time (in seconds ). To
This is absolutely feasible, but it is too complicated. The following tips will be used to generate random numbers directly in the smarty template.
Now, if you need to generate a random number between and in the smarty template, you can write it as
Template
Engine Smarty-php (as the mainstream development language)
From
: Cjjer has made some changes
The logic layer and presentation layer for implementing the MVC development mode using php (as the mainstream development language) have a variety
PHP is the world's smallest and simplest template engine ------ Pain (normal version). Unlike smarty, all variables are included in the {@}, which helps you understand the template engine.
PHP is the world's smallest and simplest template engine ----
PHP is the world's smallest and simplest template engine ------ Pain (normal version). Unlike smarty, all variables are included in the {@}, which helps you understand the template engine. Package download
Pain. php
Copy codeThe code is as follows:
What should I do if I want to generate a random number in the smarty template? Generate in the PHP file and assign values to the template. This is absolutely feasible, but it is too complicated. the following tips will be used to generate random
Package download
pain.php
Copy CodeThe code is as follows:
Class Pain
{
Public $var =array ();
Public $tpl =array ();
The the method to assign VARs to the template
Public function assign ($variable, $value =null)
{
$this->var[$variable]= $value;
}
{Math Equation=rand (125,324)}
Copy CodeWhat do you think? is not very simple, in fact, the main use of the Smarty template in the math function, the following smarty math function and usage to do a brief explanation. Math allows the
JTemplate.class.php
001
002/**003* @author Jiawei004* @Completed in 2012-6-29 0:23005*/006Class jtemplate{007Temporarily storing an array with variables passed in by the Assign function008Private $templateVar = Array ();10XTemplate
Smarty
Smarty is characterized by compiling the template into a PHP script and then executing the scripts. Very soon, very flexible.
Heyes Template Class
A very easy-to-use but powerful and fast template engine that helps you separate page layouts
First, open and use the Smarty cache
To turn on the Smarty cache, simply set the caching to true in the Smarty settings parameter and specify Cache_dir. Setting the Cache_lefetime parameter at the same time specifies the cache lifetime (in seconds)
PHPCurrently, it is one of the most widely used Dynamic Language for parsing scripts. In PHP development, developers are very concerned about how to maximize the separation of pages and business logic. Currently, many PHP development frameworks have
Now that there are many PHP template engines, and there are different template languages, I have always wondered how much benefit this can bring, so I would like to hear the views of everyone.
Reply content:In the past, the OO features of PHP are
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:
[email protected]
and provide relevant evidence. A staff member will contact you within 5 working days.