PHPLIB7.2 template function function description

xiaoxiao2021-03-06  58

Template ($ root = ", $ unknowns =" ​​remove ") constructor: root is the directory where the template file is stored, the default is the root directory unknown to process the unknown variable, Remove is unknown in the template, Keep is The unknown variable in the template is retained, and the Comment converts unknown variables to HTML annotations, the default is Remove.

The set_root ($ root) test is whether the parameter root is a directory, and if so, set the directory to the directory placed by the touch file.

Set_unknowns ($ unknowns = "keep") Sets how to handle unknown variables

Set_file ($ Handle, $ filename = ") is initialized for each template file, which is used in the later processing instead of the template file. Function call parameters can be paired with an array of Handle / FileName or by subscript is a group value value FileName

Set_block ($ PARENT, $ Handle, $ Name = ") Parameter Parent contains a block named by the parameter handle, which deletes the block and generates a new template variable in the value of the parameter name, and sets Handle contains only the templates in the original block, and if the NAME variable is omitted, it is considered to be the same as the Handle. Example: In the box template contains the ROW block:

{Title}
{num} {bignum} -> Perform $ T-> Set_block ("Box", "Row", "ROWS") BOX becomes:
{title} {rows} ROW changes to: {Num} {BIGNUM}

Set_var ($ VARNAME, $ VALUE = "") Sets the value of the template, generates an array named key name, parameter can be a pair of template variable name value or a number subscript of $ VarName.

Subst ($ handle) template displacement function, parameter handle is a handle that contains the template. The function always tries to load the template file represented by the Handle, and the replacement of the template variable contained in Handle in the case of loading.

PSUBST ($ handle) calls the subsst function and prints the result

PARSE ($ TARGET, $ HANDLE, $ APPEND = FALSE) This function calls the Subst function to replace all variables in the Handle temple handle and saves or adds to the template variable with the target of Target, and the parameter Append control is only saved or Add to Target PPARSE ($ TARGET, $ HANDLE, $ APPEND = FALSE) calls the Parse function and prints out.

GET_VARS () Returns all defined temptings and values, actually a member variable VARKEYS that traverses class, Varvals, two arrays, last return to VARKEYS, VARVALS value value value

GET_VAR ($ VARNAME) Reads Templates named VarName, parameter varName can be an array, then return a digital index number of modulus arrays

Get_undefined ($ Handle) Returns the template variable that is not processed in the Handle template

Finish ($ STR) processes the unprocessed variables in the incoming string based on the member variable UNKNOWNS to generate options before the output.

P ($ VarName) Print the string after calling the finish function

GET ($ VARNAME) Returns the template obtained by get_var ($ VarName) by calling a Finish () function.

Haltmsg ($ msg) print error message

INTERNAL Instance Methods // Internal Method

FileName ($ filename) Returns the absolute path of the template file filename and checks if the file exists.

Varname ($ VarName)

LoadFile ($ handle) load template file, such as the template variable of a handle is not set, and its file will be loaded while setting the template variable.

Halt ($ msg) stops running and displays the error message.

转载请注明原文地址:https://www.9cbs.com/read-112668.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.048, SQL: 9