首頁 後端開發 php教程 class.rFastTemplate.php一_PHP教程

class.rFastTemplate.php一_PHP教程

Jul 13, 2016 pm 05:24 PM
multi

// 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...
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

Python Pandas 實戰演練,資料處理小白的快速進階! Python Pandas 實戰演練,資料處理小白的快速進階! Mar 20, 2024 pm 10:21 PM

使用read_csv()讀取CSV檔案:df=pd.read_csv("data.csv")處理缺失值:移除缺失值:df=df.dropna()填入缺失值:df["column_name"].fillna( value)轉換資料型態:df["column_name"]=df["column_name"].astype(dtype)排序與分組:排序:df.sort_values(by="column_name")分組:groupby_object=df.groupby(by= "column_name

kvr800d2n6可與DDR3相容嗎? (kvr800d2n6是否提供4GB版本) kvr800d2n6可與DDR3相容嗎? (kvr800d2n6是否提供4GB版本) Jan 09, 2024 pm 10:33 PM

kvr800d2n6能跟ddr3一起用嗎不能。 1.因為kvr800d2n6是DDR2類型的記憶體條,而DDR3則是另一種類型的記憶體條,兩者並不相容。 2.雖然DDR2和DDR3的插槽形狀相同,但是在電壓、時序、傳輸速率等方面存在差異,因此不同類型的記憶體條不能互通。 kvr800d2n6是幾代記憶體條重新寫內容時,需要將語言改為中文,並且不改變原本的意思kvr800為內存重寫內容時,需要將語言改為中文,並且不改變原本的意思(DDR2),內存主頻是800mhz。 kvr800d2n62g是金士頓KVR800

MULTI是什麼幣種 有什麼優點 MULTI是什麼幣種 有什麼優點 Jan 31, 2024 pm 04:23 PM

MULTI幣是一種去中心化的數位貨幣,它基於智能合約技術構建,旨在提供快速、便利、低成本的資產轉移和交換服務。其優點:1、去中心化;2、跨境支付;3、低成本;4、隱私保護;5、全球性。

PHP PDO進階技巧:使用預存程序和事務處理 PHP PDO進階技巧:使用預存程序和事務處理 Feb 20, 2024 am 10:01 AM

預存程序是預先編譯並儲存在資料庫伺服器上的sql語句。當需要執行預存程序時,只需要呼叫預存程序的名字即可,而不需要重新編寫SQL語句。預存程序可以提高程式碼的可讀性和效率,尤其是在需要執行複雜或重複的SQL語句時。 1.建立預存程序CREATEPROCEDUREget_customer_by_id(INcustomer_idINT)BEGINSELECT*FROMcustomersWHEREcustomer_id=customer_id;END2.呼叫預存程序$stmt=$pdo->prepare(

成為 Java 異常處理的大師:掌控程式碼中的錯誤 成為 Java 異常處理的大師:掌控程式碼中的錯誤 Mar 24, 2024 pm 04:06 PM

Java的異常處理體系遵循一個層次結構,從最通用的Throwable類別到更具體的子類,例如Exception和Error。了解這個層次結構至關重要,因為它決定了異常的處理方式和影響範圍。二、掌握異常傳播機制異常在程式中傳播時,它會沿著呼叫堆疊向上移動。如果未在程式碼中處理異常,它將被傳播到呼叫它的方法,依此類推。掌握異常傳播機制對於確保異常得到適當處理至關重要。三、使用try-catch-finally區塊try-catch-finally區塊是Java中處理異常的首選機制。 try區塊包含需要執行的程式碼,而

逆戰哪把ak最好(逆戰ak排行) 逆戰哪把ak最好(逆戰ak排行) Jan 07, 2024 pm 06:34 PM

逆戰哪把ak最好一:AK47是一把非常有名的步槍,被廣泛使用於世界各地的軍隊和恐怖組織。它以其出色的性能和可靠性而聞名,被譽為世界上最好的突擊步槍之一。 AK47的設計簡單實用,適合在各種惡劣環境下使用。它採用了7.62毫米口徑的彈藥,具有較高的射程和穿透力。 AK47的製造成本低廉,易於維護和操作,因此廣受歡迎。儘管它在設計上存在一些局限性,但它仍然是一把非常可靠和有效的武器。無論是軍事行動還是個人防衛,AK47都是一個強大的選擇。逆戰中最經典的槍械無疑是AK47。在商城中,AK47的永久售價為

Java 記憶體模型實戰指南:如何避免並發程式設計中的常見陷阱 Java 記憶體模型實戰指南:如何避免並發程式設計中的常見陷阱 Feb 19, 2024 pm 02:45 PM

可見性:執行緒只能看到自己對共享變數所做的修改,而其他執行緒對共享變數的修改則需要透過某種同步機制才能被看到。原子性:一個操作要麼完整執行,要麼根本不執行,沒有中間狀態。有序性:執行緒對共享變數的操作必須按照一定的順序執行,即使在不同的執行緒中也是如此。二、happens-before原則happens-before原則是JMM的核心規則之一,它定義了執行緒之間共享變數的存取順序。根據happens-before原則,如果一個操作Ahappens-before另一個操作B,那麼A對共享變數的修改一定會在B

Java 語法之神殿:踏上語法朝聖之路,解鎖程式設計潛力 Java 語法之神殿:踏上語法朝聖之路,解鎖程式設計潛力 Mar 30, 2024 pm 01:01 PM

變數聲明確定變數名稱、類型和作用域。 Java支援原始(int、double、boolean)和引用(String、List)類型。二、控制流使用if/else、switch/case和循環(while、do-while、for)控製程式流。條件語句檢查條件,分支語句根據條件執行不同的程式碼區塊。三、數組數組儲存相同類型元素的集合。數組用類型[]聲明,可以透過索引存取元素。四、類別和物件類別是藍圖,用於建立具有狀態和行為的物件。物件是特定類別的實例,可以存取該類別的成員方法和變數。五、繼承子類別從父類別繼承欄位和

See all articles