static | Web Page | original by Coldwind/iwind/month/ccterran http://iwind.org
For a long time I asked people everywhere how to implement static Web pages, but also to nagging questions, and now, I finally came up with a very simple way, that is to use libtemplate to achieve it.
Everyone look: http://doc.iwind.org
I'll talk about how to implement the static page output below.
1, modify Libtemplate.
Add two functions
Save the analysis results to a file
function SaveToFile ($dir, $varname) {
$data
processing{$qstring = str_replace ("=", "", $qstring);Define ("Html_file", "./h/{$efilename}-{$qstring}.html");}Else{Define ("Html_file", "./h/{$efilename}.html");}if (file_exists (html_file)){$LCFT = Filemtime (html_file);//last Create FILE timeif ($LCFT + 3600) > Time ())//To determine whether the last generation of HTML file in the past 1 times, if not to output directly the contents of the file{if ($show _html)//is displayed in an HTML static page (0 does not show HTML display 1 with HTML d
Smarty Template if else usages and getting started tutorialSmarty main function is to complete the art and program separation, and the use of caching technology, reduce the load on the server,Smarty to place a special "Smarty tag" in the file to produce the Web page content. These tags are processed and replaced with other content.
*/
Require (' smarty/libs/smarty.class.php tutorial ');
$TPL = new Smarty ();$
free software that allows the use, copying, modification and distribution of the software and its documentation.
Any copies of the above copyright notices will be available wherever this software is used. This software is provided by the
Hui Jia Studio Maintenance, if you have any questions please contact us. Thank you for using.
//
///////////////////////////////////////////////////////////////////////////////
Require ("woods-thtml.php");//Generate HTML Processing headers
if (count ($_ge
-thtml.php");//Generate HTML Processing headers
if (count ($_get)
Require ("{$exec _file}");//Register language definition file
foreach ($lang as $key => $value)
{
$ATPL [Strtoupper ($key). " _lang "] = $value;
}
/*____________________________________ list Common sense go up the item __________________end_____________________*/
Include ("woods-templates.php");
$TPL = new Woodstpl ("./templates/");
$tpl
(REGEXP), using string objects and RegExp objects to easily implement template functionality. Mu Maple to write a Template.JScript.INC file, the content of this file is attached to the post. The ability of the reader can be based on their own needs to improve.
Here's how to use this. Because this file is written in JScript (which is easy to turn into VBScript, of course), the default scripting language is set to JScript, that is, the ASP Cheng line should be:% @Language =jscript%, and then incl
This article mainly introduces the usage of the display method and show method in thinkphp3.x, and analyzes the functions, definitions, assignments, rendering and output techniques of the thinkPHP3.x template based on examples, for more information about how to use the display and show methods in thinkphp3.x, see the examples in this article. We will share this with you for your reference. The details are as follows:
After learning about the controller and model operations in the previous artic
Use libtemplate to generate static webpages. Bycoldwindiwindmonthccterraniwind.org has been around for a long time and I have asked people how to implement static web pages, but I am still nagging myself, and now I finally come up with a very simple by coldwind/iwind/month/ccterran http://iwind.org
For a long time, I asked people around how to implement static web pages and asked questions. now, I finally come up with a very simple solution, that is, using libtemplate to implement it.
Look: http
[replace]Spacify [Blank]String_format [String formatting]Strip [remove (extra space)]Strip_tags [remove html tags]Truncate [truncate]Upper [uppercase]Wordwrap [row width constraints]Use multiple operators in combination
Example:
The Code is as follows:
{* Uppercase title *}{$ Title | upper}{* 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 = "m
my burden was heavier, just because I could not tell you this cruel fact.
So I was so worried that I took the time to write the real template engine named tmd_tpl,
Although it may not be powerful yet, it is a necessity for the future.
· Tmd _ tpl getting started Tutorial:
Next we will learn how to use tmd_tpl. The process is no different from other template engines.
I. initialize the template engine
The Code is as follows:
// Include tmd_tpl
Requi
the future.
· Tmd _ tpl getting started tutorial:
Next we will learn how to use tmd_tpl. The process is no different from other template engines.
I. initialize the template engine
The code is as follows:
// Include tmd_tpl
Require '../tmdphp/tmd_tpl.php'; // change it to the path of your tmd_tpl.
// Instantiate tmd_tpl
$ TPL = new tmd_tpl ();
// Configure tmd_tpl
// Specify the Template directory, end
"$filePath";$controller = new Indexcontroller;$controller->indexaction ();}}
Executes when the associated ' Controller ' file exists
The code is as follows
Copy Code
Include "$filePath";$controller _TP = $this->_conttoller. ' Controller ';$controller = new $controller _tp;
The above three lines of code mean that the corresponding file is included according to the Conttoller, and the corresponding Conttoller is instantiated.
The code is as
Use libtemplate to generate static webpages, and use libtemplate to generate static webpages. bycoldwind/iwind/month/ccterranhttp: // iwind.org has been around for a long time, but now I finally come up with a very simple way to use libtemplate to implement by coldwind/iwind/month/ccterran http://iwind.org.
For a long time, I asked people around how to implement static web pages and asked questions. now, I finally come up with a very simple solution, that is, using libtemplate to implement it.
L
";
}
}
The $left _1 = ' open source ' (open source) is registered as a certification mark by the non-profit software organization (Open Source Initiative Association of the United States) and is formally defined to describe the software that the source code can be used by the public, and the use of the software, Modifications and distributions are also not subject to license restrictions. Open source software is usually copyrighted ... [More ...] ';
$left _2 = '
Here are some of the commo
I made a page, using the Smarty template. The data is read in index.php and then displayed in the Index.tpl file. However, the TPL file has a button to sort the data as specified. For example, my default is that index.php is read from the database in the order of 1,2,3,4. Then there is a button in the TPL file, and the 4,3,2,1 is displayed on the following page. For now, I want to know how to transfer that
http: // locahost/skymvc/install. php to automatically createFile directory. If you want to create a new one, delete the install. Lock file.Automatic creation is recommended.You can also manually create: directories can be customized.Configure the program when creating a custom directoryAdmin background directoryAdmin/ModelAdmin/CTRLAttachUploaded attachment directoryCTRL control file directoryData DirectoryData/config. phpConfiguration FileData/cache directoryData/Cache/CSSCSS CacheData/Cache/
the source code can be used by the public, and the use of this software, Modifications and distributions are also not subject to license restrictions. OSS is usually copyrighted (copyright) ...
$left _2 = '
Here are some common files used by the site:
';
My name:)
$s _name = ' source.php ';
Import template NOW!!!
$TPL->setfile ("main", "Left.tpl");
Import Block
$TPL->setblock ("main", "Aleft", "left1
In UCH, the template and dynamic data are separated. Therefore, at the end of many PHP files, we will see the template file, such as cp_blog.php, which finally has include_once template ("cp_blog ");
In the following code, the name is regular. $ Tpl has no suffix, $ tplfile is a template file suffixed with htm, and $ objfile is a cache file suffixed with php.
The process for using a template in UCH is as follows:
Get dynamic data in php code, and th
future, as long as we include the main.php in it.
?
Include ("./smarty/libs/smarty.class.php");
Define (' Smarty_root ', './smarty/tpls ');
$ TPL = New Smarty ();
$TPL- > Template_dir = Smarty_root ." /templates/";
$TPL- > Compile_dir = Smarty_root ." /templates_c/";
$TPL- > Config_dir
become,
Is the image still visible? Is CSS still there? Not to mention include. But what about modification? Can you still recognize it at a glance?
These cannot be solved. How can these so-called template engines be "powerful?
3 ....
If there are too many templates, I will not mention them. Here I just use Smarty as an example. It is not difficult to find that other template engines are similar,
All of them are busy inventing their own template language, while the problems that really need to
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.