TPLN constructor
TPLN
TPLN
()
This method allows to rise an exception for blocks defined twice or more times in the template.
void
addBlocException
(string $str)
this method applays special function in item
string
applySpecialFunction
([string $replace = ''], [string $functions = ''])
-
string
$replace
-
string
$functions
this method changes array to html table
void
arr2HtmlTab
()
this method changes array to list
string
arr2List
([string $text = ''], string $arr, [string $bng = ''], [string $end = ''])
-
string
$text
-
string
$arr
-
string
$bng
-
string
$end
This method allows to convert a php array to a javascript array, it is useful for Ajax.
string
array2json
(array $arr)
method allows to know if a block exists in the template file.
boolean
blocExists
(string $bloc_name)
this method verifies if cach directory exists
boolean
cacheDirExists
()
this method captures all blocks
string
captureAllBlocs
([string $subject = ''])
this method captures block
string
captureBloc
(string $name, string $subject)
-
string
$name
-
string
$subject
this method captures include commands in the template
boolean
captureIncludeCmd
()
this method captures items
string
captureItems
([string $subject = ''], [string $type = ''])
-
string
$subject
-
string
$type
this method captures items in each block
boolean
captureItemsInEachBloc
()
this method allows to select a template opened by Open()
or DefineTemplate() methods either by name or by number.
void
changeTemplate
(string $key)
this method allows to delete the blocks.
void
cleanBlocs
()
This method allows to convert http, www, ftp, mailto into clickable element
string
clickable
(string $ret)
this method creates file cache
boolean
createCache
()
this method allows to create a virtual template.
boolean
createVirtualTemplate
(string $countain)
this method
void
defineBloc
(string $path)
this method allows to open and to name various templates.
void
defineTemplate
(array $arr)
this method is a macro wich allows to open and to return a template.
string
directIoOutput
([string $file = ''])
this method is a macro which allows to open and to save a template.
void
directIOSave
([string $file = ''], string $path)
-
string
$file
-
string
$path
this method is a macro which allows to open and to write a template.
void
directIoWrite
([string $file = ''])
this method
void
directParseInBloc
(array $fathers_arr, int $item, int $replace)
-
array
$fathers_arr
-
int
$item
-
int
$replace
this method
void
directParseInFile
(int $item, int $replace)
this method verifies if block is not in double
void
dualBlocVerify
()
This method allows to display the countain of a php variable to facilite debugging
string
dump
([string $label = 'Debug'], string $data, [boolean $return = 0])
-
string
$label
-
string
$data
-
boolean
$return
this method
void
encapsuleBlocs
(array $bloc_arr, array $child_blocs)
-
array
$bloc_arr
-
array
$child_blocs
this method verifies if end block is not in double
endBlocVerify
()
this method allows you to delete a block.
But if the bolck is one, the substitution will be done in the template.
void
eraseBloc
(string $path, [string $msg = ''])
this method allows to delete a variable.
void
eraseItem
(string $item)
void
error
( $err_no, [ $file = ''], [ $bloc = ''], [ $item = ''])
-
$err_no
-
$file
-
$bloc
-
$item
this method evals template file
string
evalHtml
(string $string)
this method extracts string
string
extractStr
(string $str, string $start, string $end, [bool $inc_markup = 0])
-
string
$str
-
string
$start
-
string
$end
-
bool
$inc_markup
this method is like Parse() method but it avoids to rewrite definied variables.
void
fastParse
(string $path, [string $functions = ''])
-
string
$path
-
string
$functions
this method activates template structure
void
fileStructMode
()
This method allows to recover the contents of the text of the block,
useful to recover the text after an exit of template
string
getAjaxBloc
(string $bloc_name, [string $out = ''])
-
string
$bloc_name
-
string
$out
this method gets all blocks
array
getAllBlocs
(string $subject)
this method
string
getBigBlocs
()
this method allows to return a whole block from the template file.
string
getBlocInFile
(string $path)
this method returns cached file
void
getCachedFile
()
this method
void
getExecutionTime
()
this method returns the last father
string
getFather
(string $path)
this method returns all fathers in array
string
getFathers
(string $path, [string $type = ''], [int $with_item = 1])
-
string
$path
-
string
$type
-
int
$with_item
this method allows you to return the contents of file.
If the block name optional parameter is specified the method will return
the contents of the block defined in the file.
string
getFile
(string $filename, [string $blocname = ''])
-
string
$filename
-
string
$blocname
This method returns ip used.
string
getIP
()
this method returns the last item
string
getItem
(string $path)
this method
array
getNextGenerationBlocs
(array $bloc_arr)
This method returns curent template index
int
getTemplateID
()
this method gets current time
int
getTime
()
This method allows to compress the template.
void
htmlCompress
(boolean $bool)
this method verifies if template is expired
boolean
inCachePeriod
()
this method allows to substitute a variable from the template file by the contents of a file.
void
includeFile
(string $item, string $file)
-
string
$item
-
string
$file
this method inisializes path in TPLN memory manager
array
initialiazeBloc
( $bloc)
this method initializes template variables
void
initTemplateVars
()
this method returns if it is a block
boolean
isBlocDesired
(string $path)
this method verifies if all the block are defined
boolean
isDefined
(string $path, [string $type = ''])
-
string
$path
-
string
$type
this method returns if template is a PHP file
boolean
isPhpFile
(string $filename)
this method allows to know if a variable exists in the template file.
boolean
itemExists
(string $item_name, [string $bloc = ''])
-
string
$item_name
-
string
$bloc
this method verifies item
boolean
itemVerify
(string $item, [string $bloc = ''])
-
string
$item
-
string
$bloc
this method allows to substitute the items by the pairs keys of an array in a whole block.
The 3rd parameters allows to replace entire block if no data foud in array.
void
loadArrayInBloc
(string $path, array $arr, [string $msg = ''], [boolean $looped = false])
-
string
$path
-
array
$arr
-
string
$msg
-
boolean
$looped
this method allows to use plugin for TPLN.
void
loadPlugin
(string $name)
this method is applied to a block to report is looping.
void
loop
(string $path)
this method sends mail admin alert
void
mailAlert
()
this method allows to open template file which can to support any extensions of file (.htm, .html, .tpl, .php ... ).
if none name of file has been defined, it will open the file which have the same name
as the script with extension per defect.
boolean
open
([string $file = ''], [CACHED $cached = ''], [int $cached_time = ''])
-
string
$file
-
CACHED
$cached
-
int
$cached_time
this method allows to return the contents of the template file parsed.
string
output
()
void
outPutMessage
([ $exit = true])
this method allows to substitute a variable defined inside the template file.
TPLN use a style javascript pseudo object language to access to the variable by the separator ".".
void
parse
(string $path, string $replace, [string $functions = ''])
-
string
$path
-
string
$replace
-
string
$functions
this method replaces all include commands
boolean
parseAllIncludeCmd
()
this method
void
parseBigFathers
()
this method allows to substitute a whole bloc and markers also.
void
parseBloc
(string $path, string $replace)
-
string
$path
-
string
$replace
this method replaces { _Chrono} by the time clock of the template
void
parseChrono
()
this method replaces all php constants in template
void
parseConstants
()
this method
void
parseEncapsuledBlocs
(array $bloc)
this method allows to parse a variable Php by a variable contained in the template.
void
parseGlobals
()
this method replaces include command
void
parseIncludeCmd
(string $file)
this method replaces { _Logo} by TPLN Logo
void
parseLogo
()
this method replaces all PHP commands
void
parsePhpCommands
()
this method replaces { _QueryCount} by the numbre of queries executed.
void
parseQueryCount
()
this method
boolean
parseSubBlocs
(int $level, array $bloc_arr)
-
int
$level
-
array
$bloc_arr
this method replaces { _Version} by TPLN current version
void
parseVersion
()
this method verifies path
boolean
pathVerify
(string $path)
This method allows to redirect to a new web page
void
redirect
(string $uri, [int $timer = 0])
-
string
$uri
-
int
$timer: default 0
this method allows to reload variables of a block contained in the template.
void
reloadBlocVars
(string $path)
this method replaces block
boolean
replaceBloc
(string $name, string $replace, string $subject)
-
string
$name
-
string
$replace
-
string
$subject
this method replaces item
boolean
replaceItem
(string $name, string $replace, string $subject)
-
string
$name
-
string
$replace
-
string
$subject
this method registers path in TPLN memory manager
void
savePath
(string $fathers_path)
this method allows to save the contents of the template file parsed.
void
saveTemplate
(string $path)
this method allows to know template total time execution.
The variable { _Chrono} must be imperatively replaced inside your template file.
void
setChrono
([string $type = 'this'])
this method allows to select a template which has been opened by the Open()
or DefineTemplate() methods is by a name or a number.
void
setTemplate
(string $key)
this method allows you to select a template opened by Open()
or DefineTemplate() methods either by name or by number.
void
setTemplateID
(string $key)
this method returns block structure
void
structBlocs
()
this method returns file structure
void
structFile
()
this method returns item structure
void
structItems
()
this method gets opened template
void
structOpen
()
PHP str replace with count parameter
string
str_replace_count
(string $search, string $replace, string $subject, int $times)
-
string
$search
-
string
$replace
-
string
$subject
-
int
$times
this method
void
traceMode
()
this method allows to print file the template parsed.
void
write
()
This method allows to protect data against XSS attack,
this method is used before insetring records in a database.
string
xssProtect
(string $string)