: User system data abstraction
* * Author: Ye Shinming
* * Time: 2005-8-30-10:05
*/
Class User {
var $id = 0;
var $Name = "";
var $Password = "";
var $db = "";
var $tpl = "";
/*
* * Function Function: constructor, specifies the database connection used by the class
* * Parameter Description: $TPL, display template handle; $userdb, database connection
* * Return value: None
* * Author: Ye Shinming
* * Crea
transplanted to the PHP3 platform. You only need a base class file class. FastTemplate. php3
First, explain the difference between using a template and using the echo or print command to create an html page. echo and print are very useful in writing short scripts, however, the organization and customization of the scripts made are not good, and it takes a lot of effort to modify them. templates are much more efficient in writing websites that support multiple languages, for example, echo and p
*}{* Take the first 40 characters *}Topic: {$ topic | truncate: 40 :"..."}{* Format text string *}{"Now" | date_format: "% Y/% m/% d "}{* Apply the regulator in a custom function *}{Mailto | upper address = "main@cn-web.com "}Capitalize (uppercase)
The index. php page is as follows:
Copy codeThe Code is as follows: $ smarty = new Smarty;$ Smarty-> assign ('articletitle', 'police begin campaign to rundown jaycyclers .');$ Smarty-> display ('index. tpl
6.5 installation process in the Win7 64-bit virtual machine VMware and is used by a non-root user with a username of 007.
The RedHat6.5 version information used is as follows, if you look for GCC to get content inconsistent with the following figure, such as no gcc-gfortran, please ignore:2 installation package Preparation
The installation packages prepared here mainly include R installation, Rserve installation packages and possible dependency packs
. php template initialization file for initial template information.C) the templates directory stores all template files.D) The templates_c directory stores all the compiled files.E) the cache directory stores all cached files.F) the classes directory stores all class files.G) The config directory stores the template system variable configuration file.
The following is the source code:
Index. php of the main file
// Set the encoding to UTF-8Header ('content-Type: text/html; Charset = UTF-8
(s) I am Alexsel age Alexsel>>> s ="I am% (N1) 010s age% (N1) s"% {"N1":"Alexsel"}#Align Right>>>Print(s) I am Alexsel age Alexsel>>> s ="I am% (N1) +010d age% (N1) d"% {"N1": 19}#Align Right with 0>>>Print(s) I am+000000019 Age 19>>> S ="I am%.2f age"% (1.2)#two-bit decimal point f default 6-bit>>>Print(s) I am1.20 Age>>> s ="I am%c"% (250)#symbols corresponding to Unicode codes>>>Print(s) I amúCommon formatting:>>> TPL ="I am%s"%"Alex">>>Print(
simple call:
Pass it a path, which is the directory where all your template files are stored. It returns an object. You can use it for parameters.Number Assignment, page generation, and so on.
Fasttemplate is based on the assumption that a large page is composed of many small parts. Each part has a unique. The smallest part is a normal text string with a unique name. You can use$ TPL-> assign (name, "text ");?>. Now, if one of your templates co
.shtml ). You only need a class file (class. FastTemplate. php ).
Let me explain the difference between generating a page using a template and simply outputting a page through echo or PRint.The echo/print method is suitable for writing short scripts, but it cannot help you better organize and customize the scripts. In additionBy modifying a parameter. They can make you more concerned about what you want to do.
Do not be afraid to think before coding. It may take some time, but it will return to
outputting a page through echo or PRint.The echo/print method is suitable for writing short scripts, but it cannot help you better organize and customize the scripts. In additionBy modifying a parameter. They can make you more concerned about what you want to do.
Do not be afraid to think before coding. It may take some time, but it will return to you as the project develops.
So, how to apply FastTemplate? First, you need to make a simple call:
?>Pass it a path, which is the directory where a
the author in the Windows installation Appserv as an example, the program's main folder is "d:\appserv\web\demo\". After installing the smarty, we will create the folder under the main folder:Under Linux, remember to change the permissions of the Templates_c to 777. It is read-only cancellation under Windows. The first small program written with Smarty We set the Smarty path First, please name the following file as main.php and place it under the main folder: main.php:
Inclu
different programs directly referenced, without repeatedly installing too many copies of the Smarty. And the author provides the way is suitable to bring the program to move over the program developers use, so do not worry about the host has not installed Smarty.
Program Folder Settings
Take the author in the Windows installation Appserv as an example, the program's main folder is "d:\appserv\web\demo\". After installing the smarty, we will create the folder under the main folder
As you can see, the examples in the previous sections use$ TPL-> set_file ("Main", "template file name ");To load the template file. The name is only "Main" because we want to give it a meaning: The main template. "Sub-template". Similarly, footer.html is also a "sub-template". We want to place it in the {footer} position of the main template. A master template can be embedded with any number of sub-templates with unlimited content, size, and format.
php file, the latter is like the header and tail of the page that a site needs. the advantage of doing so is that you can easily maintain the site, and if this public part needs to be changed, you do not need to modify every page, greatly reducing our workload.In the past, you may use require, include (require_once, include_once) to introduce a public page header, which is indeed convenient and effective. now we can use the Template class to implement it, you can easily insert a page to any par
page into another template anywhere. If you want to also make a template that contains variables for the page you want to insert, you'll find that the template class handles the job very well.
Create a new three file third.html,header.html,footer.html in the template directory. The content is divided into the followingThird.html
Here is a list
Header.html
Footer.html
As you can see, the examples in our previous sections are$TPL->set_file ("mai
needs. the advantage of doing so is that you can easily maintain the site, and if this public part needs to be changed, you do not need to modify every page, greatly reducing our workload.In the past, you may use require, include (require_once, include_once) to introduce a public page header, which is indeed convenient and effective. Now we can use the template class to implement it, you can easily insert a page to any part of another template. if you want to make the page to be inserted into a
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.