Ideas:To achieve a balance between speed and ease of use (mainly referring to the convenience of art design). So the way to generate PHP files from HTML files (compile?)Also want to balance between separating the display logic and separating the HTML codeFor example, a forum home page (index.php):
Code:
Require ('./template.php ');The HTML-generated PHP file is prefixed with a different style.$tpl _prefix = ' default ';
folder, which has two main folders demo and Libs
The demo folder is the sample folder, which contains the default folder structure, which is the main folder where we want to write the program code. Demo in the folder name is smarty default directory structure name, you can change the corresponding property value Smarty, and then change the folder name to the name we want.Libs is a Smarty Code source folder, generally not moving.
/libs/smarty.class.php #主文件
/libs/sysplugins/#内部plugin
/libs/p
separate file, which is the file that is actually called by the page URL. The Web server parses the file through the PHP engine and returns the results to the browser. Generally, PHP code always dynamically generates page content, such as querying a database or performing some sort of calculation. Here is an example:
example.php
Require (' class. Fasttemplate.php ');
$TPL = new Fasttemplate ('. ');
$TPL
$ TPL = new smarty (); // create a new smarty object. What I use isSmarty-1, 3.1.6Version
1. Set the path to the smarty template $ TPL->Settemplatedir ()By defaultTemplates
2. Set the path for compiling the smarty template $ TPL->Setcompiledir ()By defaultTemplates_c
3. Set the Left and Right Separators of the smarty template engine,
$
template program (fasttemplate), the problem now is how to implement similar functions in ASP.
Microsoft's ASP comes with two kinds of scripts: VBScript and JScript. They all carry a "regular Expression object" (REGEXP) that makes it easy to implement template functionality with string objects and RegExp objects. Mu Maple to write a "Template.JScript.INC" file, the contents of this file attached to the post. The ability of the reader can be based on their own needs to improve.
Here's how to us
are much more efficient when writing sites that support multiple languages, such as using echo and print to visualize the workload.
Do not worry, skilled use of fasttemplate will take up part of your time, but these times will be in your future work to make up for back, especially when the big project.
So, how do you use Fasttemplate?
The first step is simply to use the function
, where path points to the path where the template directory resides. This function establishes a $
The usage of Smarty-related considerations and several ways to share access variables, you can refer to the need of friends. $ Tpl = new Smarty (); // create a new smarty object. what I use is
Smarty-1, 3.1.6Version
1. set the path to the smarty template $ tpl->
SetTemplateDir ()By default
Templates2. set the path for compiling the smarty template $ tpl->
SetComp
The usage of Smarty-related considerations and several ways to share access variables, you can refer to the need of friends.
The usage of Smarty-related considerations and several ways to share access variables, you can refer to the need of friends.
$ Tpl = new Smarty (); // create a new smarty object, which is a version1. Set the path to the smarty template $ tpl->SetTemplateDir ()By defaultTemplate
Copy codeThe Code is as follows:/* Template. class. php@ Kangsheng Weibo Template Extraction class thinks this template is easy to use and takes some time to be independent. By raysun@ Check whether the ctt template is similar to the phpcms template ?? ^_^ Hey !!!@ Micro blog http://weibo.com/lrjxgl@ Good stuff everyone can share with us all the difficulties to extract. If you have any questions, please come up with me.@ The default template file is. htm.$ T
$ Tpl = new Smarty (); // create a new smarty object. What I use isSmarty-1, 3.1.6Version1. Set the path to the smarty template $ tpl->SetTemplateDir ()By defaultTemplates2. Set the path for compiling the smarty template $ tpl->SetCompileDir ()By defaultTemplates_c3. Set the Left and Right Separators of the smarty template engine,
$
The usage of Smarty-related considerations and several ways to share access variables, you can refer to the need of friends. $ Tpl = new Smarty (); // create a new smarty object. what I use is
Smarty-1, 3.1.6Version
1. set the path to the smarty template $ tpl->
SetTemplateDir ()By default
Templates2. set the path for compiling the smarty template $ tpl->
SetComp
Copy CodeThe code is as follows:
/*template.class.php@ Kang Shengweibo Template Extraction class think this template useful to spend some time independent out. by Rezhigin@ have a look at CTT this template is similar to Phpcms's template?? ^_^ Hey!!!@ Micro Bo Http://weibo.com/lrjxgl@ Good things everyone sharing stumbling pull out there's a problem please come upThe @ template file defaults to. htm$TPL = new Template (' Skin ', ' default ');$
Copy Code code as follows:
/*template.class.php
@ Kang Shengweibo Template Extraction class feel this template easy to spend some time independent. by Rezhigin
@ Look at CTT This template is similar to Phpcms's template?? ^_^ Hey!!!
@ Micro Bo Http://weibo.com/lrjxgl
@ Good things everyone share the stumbling of the extraction of the problem please put forward
The @ template file defaults to. htm
$TPL = new Template (' Skin ', ' default ')
Copy codeThe Code is as follows: /* Template. class. php
@ Kangsheng Weibo Template Extraction class thinks this template is easy to use and takes some time to be independent. By raysun
@ Check whether the ctt template is similar to the phpcms template ?? ^_^ Hey !!!
@ Micro blog http://weibo.com/lrjxgl
@ Good stuff everyone can share with us all the difficulties to extract. If you have any questions, please come up with me.
@ The default template file is. htm.
$
Templates extracted from the discuz product. For more information about learning php, see.
The code is as follows:
/* Template. class. php
@ Kangsheng Weibo template extraction class thinks this template is easy to use and takes some time to be independent. By raysun
@ Check whether the ctt template is similar to the phpcms template ?? ^_^ Hey !!!
@ Micro blog http://weibo.com/lrjxgl
@ Good stuff everyone can share with us all the difficulties to extract. if you have any questions, please come
Template class extracted from the discuz product. Copy the code as follows :? Php * template. class. php @ Kangsheng Weibo template extraction class thinks this template is easy to use and takes some time to separate it. By Lei Rijin @ looked at the ctt template and
The code is as follows:
/* Template. class. php@ Kangsheng Weibo template extraction class thinks this template is easy to use and takes some time to be independent. By raysun@ Check whether the ctt template is similar to the ph
Copy CodeThe code is as follows:
/*template.class.php
@ Kang Shengweibo Template Extraction class feel this template easy to spend some time independent. by Rezhigin
@ Look at CTT This template is similar to Phpcms's template?? ^_^ Hey!!!
@ Micro Bo Http://weibo.com/lrjxgl
@ Good things everyone share the stumbling of the extraction of the problem please put forward
The @ template file defaults to. htm
$TPL = new Template (' Skin ', ' default ');
$
suitable to bring the program to move over the program developers to use, so as not to worry about the host installed Smarty.
Folder settings for the program
With the author in Windows installation Appserv as an example, the program's Master folder is "d:appservwebdemo". After installing the smarty, we create the folder under the Master folder:
Under Linux, remember to change the permissions of Templates_c to 777. Windows will cancel it read-only.
The first small program written in Smarty
We fi
. It may take some time, but these costs will pay off as the project progresses.
So, how do you apply fasttemplate? First you need to make a simple call:
Pass it a path that is the directory where all your template files are stored. It returns an object that you can use to participate in
Number assignments, generating pages, and so on.
Fasttemplate is based on the assumption that a large page is made up of a lot of small parts. Each part has a unique
's name. The smallest part is an assig
organize and customize. The template on the other hand givesYour ability to create multi-lingual sites, just by changing one parameter. They can motivate you to care more about what you do.
Don't be afraid to think before you start coding. It may take some time, but these costs will be rewarded for you as the project progresses.
So, how to apply fasttemplate? First, you need to make a simple call first:
?>Pass to it a path that is the directory where all your template files are stored. It r
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.