Home Backend Development PHP Tutorial class.rFastTemplate.php一_PHP教程

class.rFastTemplate.php一_PHP教程

Jul 13, 2016 pm 05:24 PM
multi one

// 2001 Alister Bulman Re-Port multi template-roots + more // PHP3 Port: Copyright ?1999 CDI , All Rights Reserved. // Perl Version: Copyright ?1998 Jason Moore , All Rights Reserved. // // RCS Revision // @(#) $Id: class.rFastTemplate.php,v 1.22 2001/10/18 21:36:53 roland Exp $ // $Source: /home/cvs/projects/php/tools/class.rFastTemplate.php,v $ // // Copyright Notice // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // class.rFastTemplate.php is distributed in the hope that it will be // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // Comments // // I would like to thank CDI for pointing out the // copyright notice attached to his PHP3 port which I had blindly missed // in my first release of this code. // // This work is derived from class.FastTemplate.php3 version 1.1.0 as // available from http://www.thewebmasters.net/. That work makes // reference to the "GNU General Artistic License". In correspondence // with the author, the intent was to use the GNU General Public License; // this work does the same. // // Authors // // Roland Roberts // Alister Bulman (multi template-roots) // Michal Rybarik (define_raw()) // CDI , PHP3 port // Jason Moore , original Perl version // // Synopsis // // require ("PATH-TO-TEMPLATE-CODE/class.Template.php"); // $t = new Template("PATH-TO-TEMPLATE-DIRECTORY"); // $t->define (array(MAIN => "diary.html")); // $t->setkey (VAR1, "some text"); // $t->subst (INNER, "inner") // $t->setkey (VAR1, "some more text"); // $t->subst (INNER, ".inner") // $t->setkey (VAR2, "var2 text"); // $t->subst (CONTENT, "main"); // $t->print (CONTENT); // // Description // // This is a class.FastTemplate.php3 replacement that provides most of the // same interface but has the ability to do nested dynamic templates. The // default is to do dynamic template expansion and no special action is // required for this to happen. // // class.FastTemplate.php3 Methods Not Implemented // // clear_parse // Same as clear. In fact, it was the same as clear in FastTemplate. // clear_all // If you really think you need this, try // unset $t; // $t = new Template ($path); // which gives the same effect. // clear_tpl // Use unload instead. This has the side effect of unloading all parent // and sibling templates which may be more drastic than you expect and // is different from class.FastTemplate.php3. This difference is // necessary since the only way we can force the reload of an embedded // template is to force the reload of the parent and sibling templates. // // class.FastTemplate.php3 Methods by Another Name // // The existence of these functions is a historical artifact. I // originally had in mind to write a functional equivalent from scratch. // Then I came my senses and just grabbed class.FastTemplate.php3 and // started hacking it. So, you can use the names on the right, but the // ones on the left are equivalent and are the names used in the original // class.FastTemplate.php3. // // parse --> subst // get_assiged --> getkey // assign --> setkey // clear_href --> unsetkey // clear_assign --> unsetkey // FastPrint --> xprint // class rFastTemplate { // File name to be used for debugging output. Needs to be set prior to // calling anything other than option setting commands (debug, debugall, // strict, dynamic) because once the file has been opened, this is ignored. var $DEBUGFILE = /tmp/class.rFastTemplate.php.dbg; // File descriptor for debugging output. var $DEBUGFD = -1; // Array for individual member functions. You can turn on debugging for a // particular member function by calling $this->debug(FUNCTION_NAME) var $DEBUG = array (); // Turn this on to turn on debugging in all member functions via // $this->debugall(). Turn if off via $this->debugall(false); var $DEBUGALL = false; // Names of actual templates. Each element will be an array with template // information including is originating file, file load status, parent // template, variable list, and actual template contents. var $TEMPLATE = array(); // Holds paths-to-templates (See: set_root and FindTemplate) var $ROOT = array(); // Holds the HANDLE to the last template parsed by parse() var $LAST = ; // Strict template checking. Unresolved variables in templates will generate a // warning. var $STRICT = true; // If true, this suppresses the warning generated by $STRICT=true. var $QUIET = false; // Holds handles assigned by a call to parse(). var $HANDLE = array(); // Holds all assigned variable names and values. var $VAR = array(); // Set to true is this is a WIN32 server. This was part of the // class.FastTemplate.php3 implementation and the only real place it kicks // in is in setting the terminating character on the value of $ROOT, the // path where all the templates live. var $WIN32 = false; // Automatically scan template for dynamic templates and assign new values // to TEMPLATE based on whatever names the HTML comments use. This can be // changed up until the time the first parse() is called. Well, you can // change it anytime, but it will have no effect on already loaded // templates. Also, if you have dynamic templates, the first call to parse // will load ALL of your templates, so changing it after that point will // have no effect on any defined templates. var $DYNAMIC = true; // Grrr. Dont try to break these extra long regular expressions into // multiple lines for readability. PHP 4.03pl1 chokes on them if you do. // Im guessing the reason is something obscure with the parenthesis // matching, the same sort of thing Tcl might have, but Im not sure. // Regular expression which matches the beginning of a dynamic/inferior // template. The critical bit is that we need two parts: (1) the entire // match, and (2) the name of the dynamic template. The first part is // required because will do a strstr() to split the buffer into two // pieces: everything before the dynamic template declaration and // everything after. The second is needed because after finding a BEGIN // we will search for an END and they both have to have the same name of // we consider the template malformed and throw and error. // Both of these are written with PCRE (Perl-Compatible Regular // Expressions) because we need the non-greedy operators to insure that // we dont read past the end of the HTML comment marker in the case that // the BEGIN/END block have trailing comments after the tag name. var $REGEX_DYNBEG = /()/; // Regular expression which matches the end of a dynamic/inferior // template; see the comment about on the BEGIN match. var $REGEX_DYNEND = /()/; // Regular expression which matches a variable in the template. var $REGEX_VAR = /{[A-Za-z][-_A-Za-z0-9]*}/; // // Description // Constructor. // function rFastTemplate ($pathToTemplates = ) { // $pathToTemplates can also be an array of template roots, handled in set_root global $php_errormsg; if (!empty($pathToTemplates)) { $this->set_root ($pathToTemplates); } $this->DEBUG = array (subst => false, parse_internal => false, parse_internal_1 => false, parsed => false, clear => false, clear_dynamic => false, load => false); return $this; } // // Description // Set the name to be u

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/532115.htmlTechArticle// 2001 Alister Bulman Re-Port multi template-roots + more // PHP3 Port: Copyright ?1999 CDI , All Rights Reserved. // Perl Version: Copyright ?1998 Jason Moore , All Rights Reserv...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Python Pandas practical drill, a quick advancement for data processing novices! Python Pandas practical drill, a quick advancement for data processing novices! Mar 20, 2024 pm 10:21 PM

Use read_csv() to read CSV files: df=pd.read_csv("data.csv") Handle missing values: Remove missing values: df=df.dropna() Fill missing values: df["column_name"].fillna( value) Convert data type: df["column_name"]=df["column_name"].astype(dtype) Sorting and grouping: Sorting: df.sort_values(by="column_name") Grouping: groupby_object=df.groupby(by= "column_name

Is kvr800d2n6 compatible with DDR3? (Does kvr800d2n6 provide 4GB version) Is kvr800d2n6 compatible with DDR3? (Does kvr800d2n6 provide 4GB version) Jan 09, 2024 pm 10:33 PM

Can kvr800d2n6 be used with ddr3? No. 1. Because kvr800d2n6 is a DDR2 memory module, and DDR3 is another type of memory module, the two are not compatible. 2. Although the slot shapes of DDR2 and DDR3 are the same, there are differences in voltage, timing, transmission rate, etc., so different types of memory modules cannot be interoperable. kvr800d2n6 is a memory stick of several generations. When rewriting the content, the language needs to be changed to Chinese without changing the original meaning. kvr800 When rewriting the content of the memory, the language needs to be changed to Chinese without changing the original meaning (DDR2). Memory The main frequency is 800mhz. kvr800d2n62g is Kingston KVR800

What currency is MULTI and what are its advantages? What currency is MULTI and what are its advantages? Jan 31, 2024 pm 04:23 PM

MULTI coin is a decentralized digital currency that is built based on smart contract technology and aims to provide fast, convenient, and low-cost asset transfer and exchange services. Its advantages: 1. Decentralization; 2. Cross-border payment; 3. Low cost; 4. Privacy protection; 5. Globality.

PHP PDO Advanced Tips: Using Stored Procedures and Transactions PHP PDO Advanced Tips: Using Stored Procedures and Transactions Feb 20, 2024 am 10:01 AM

Stored procedures are sql statements that are precompiled and stored on the database server. When you need to execute a stored procedure, you only need to call the name of the stored procedure without rewriting the SQL statement. Stored procedures can improve code readability and efficiency, especially when complex or repetitive SQL statements need to be executed. 1. Create the stored procedure CREATEPROCEDUREget_customer_by_id(INcustomer_idINT)BEGINSELECT*FROMcustomersWHEREcustomer_id=customer_id;END2. Call the stored procedure $stmt=$pdo->prepare(

Become a master of Java exception handling: Take control of errors in your code Become a master of Java exception handling: Take control of errors in your code Mar 24, 2024 pm 04:06 PM

Java's exception handling system follows a hierarchical structure, from the most general Throwable class to more specific subclasses such as Exception and Error. Understanding this hierarchy is critical because it determines how exceptions are handled and their scope. 2. Master the exception propagation mechanism. When an exception propagates in the program, it will move up the call stack. If the exception is not handled in the code, it will be propagated to the method that called it, and so on. Understanding exception propagation mechanisms is critical to ensuring exceptions are handled appropriately. 3. Use the try-catch-finally block The try-catch-finally block is the preferred mechanism for handling exceptions in Java. The try block contains the code that needs to be executed, while

Which ak is the best in counter-war (ranking of ak in counter-war) Which ak is the best in counter-war (ranking of ak in counter-war) Jan 07, 2024 pm 06:34 PM

Which AK is the best in counter-war: AK47 is a very famous rifle that is widely used by armies and terrorist organizations around the world. It is known for its excellent performance and reliability and is regarded as one of the best assault rifles in the world. The design of AK47 is simple and practical, suitable for use in various harsh environments. It uses 7.62mm caliber ammunition, which has high range and penetration. The AK47 is cheap to manufacture and easy to maintain and operate, making it popular. Although it has some limitations in its design, it is still a very reliable and effective weapon. Whether for military operations or personal defense, the AK47 is a powerful choice. The most classic firearm in the counter war is undoubtedly the AK47. In the mall, the permanent selling price of AK47 is

A practical guide to the Java memory model: How to avoid common pitfalls in concurrent programming A practical guide to the Java memory model: How to avoid common pitfalls in concurrent programming Feb 19, 2024 pm 02:45 PM

Visibility: A thread can only see its own modifications to shared variables, while modifications to shared variables by other threads require some kind of synchronization mechanism to be seen. Atomicity: An operation is either completely executed or not executed at all, with no intermediate state. Orderliness: Thread operations on shared variables must be performed in a certain order, even in different threads. 2. happens-before principle The happens-before principle is one of the core rules of JMM, which defines the access sequence of shared variables between threads. According to the happens-before principle, if an operation Ahappens-before another operation B, then A's modification of the shared variable will definitely occur in B

The Temple of Java Grammar: Embark on a Pilgrimage to Grammar and Unlock Your Programming Potential The Temple of Java Grammar: Embark on a Pilgrimage to Grammar and Unlock Your Programming Potential Mar 30, 2024 pm 01:01 PM

A variable declaration determines the variable name, type, and scope. Java supports primitive (int, double, boolean) and reference (String, List) types. 2. Control flow Use if/else, switch/case and loops (while, do-while, for) to control program flow. Conditional statements check conditions, and branch statements execute different blocks of code based on conditions. 3. Array Array stores a collection of elements of the same type. Arrays are declared with type [] and elements can be accessed by index. 4. Classes and Objects Classes are blueprints used to create objects with state and behavior. An object is an instance of a specific class and has access to the member methods and variables of that class. 5. Inherited subclasses inherit fields and

See all articles