Php html template it pear

Содержание
  1. Introduction
  2. Placeholder
  3. Blocks
  4. Usage Example
  5. Class: HTML_Template_IT
  6. Class Variables
  7. $blocknameRegExp = ‘[\.0-9A-Za-z_-]+’
  8. $clearCache = false
  9. $clearCacheOnParse = false
  10. $closingDelimiter = ‘>’
  11. $err = array()
  12. $openingDelimiter = ‘ First character of a variable placeholder ( _ ). $removeEmptyBlocks = true Controls the handling of empty blocks, default is remove. $removeUnknownVariables = true Controls the handling of unknown variables, default is remove. $variablenameRegExp = ‘[\.0-9A-Za-z_-]+’ RegExp matching a variable placeholder in the template. Per default «sm» is used as the regexp modifier, «i» is missing. That means a case sensitive search is done. Method Detail HTML_Template_IT (Constructor) [line 410] Make sure that you call this constructor if you derive your template class from this one. Parameters: string $root — File root directory, prefix for all filenames given to the object. mixed $options — Unknown Источник Package Information: HTML_Template_IT Changes since last stable release (1.2.1): — Add support for pear package 2.0 format — Remove support for pear package 1.0 format — Fix bug #9501, doller signs disapear if preg_match is used. — Fix bug #9783, don’t remove variable which values follow the variable pattern To allow backwards compatbility an option preserve_input is added. If it is false, the old behaviour will be used and therefore those values will be deleted. Default is true, so new behaviour. — Fix bug #9853, problems with dots in placeholders or blocknames — Fix bug #13935, docblock is wrong — Fix bug #17129 — Add option ‘preserve_input’ to only remove unkown variable that were present during setTemplate or loadTemplatefile which is the behaviour before 1.3.0a1 — Improved PHPCS (Request #15039) — Added unit tests — Fixed unit tests Easy Install pear install HTML_Template_IT-1.3.0a3 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.3.0a3 Download For manual installation only Release date: 2010-03-01 05:14 UTC Release state: alpha Release uploaded by: gregorycu Easy Install pear install HTML_Template_IT-1.3.0a2 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.3.0a2 Download For manual installation only Release date: 2010-02-16 02:13 UTC Release state: alpha Release uploaded by: doconnor Easy Install pear install HTML_Template_IT-1.3.0a1 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.3.0a1 Download For manual installation only Release date: 2008-12-27 02:13 UTC Release state: alpha Release uploaded by: doconnor — Add support for pear package 2.0 format — Remove support for pear package 1.0 format — Fix bug #9501, doller signs disapear if preg_match is used. — Fix bug #9783, don’t remove variable which values follow the variable pattern To allow backwards compatbility an option preserve_input is added. If it is false, the old behaviour will be used and therefore those values will be deleted. Default is true, so new behaviour. — Fix bug #9853, problems with dots in placeholders or blocknames — Add option ‘preserve_input’ to only remove unkown variable that were present during setTemplate or lodaTemplatefile which is the behaviour before 1.3.0a1 — Fix bug #13935 — docblock is wrong — Improved PHPCS (Request #15039) Easy Install pear install HTML_Template_IT-1.2.1 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.2.1 Download For manual installation only Release date: 2006-08-25 10:11 UTC Release state: stable Release uploaded by: dsp — Deprecate $callbackobject parameter in setCallbackFunction — Introduce $expandCallbackParameters parameter to setCallbackFunction to support callbacks that expect to get the parameters in a regular way, not as an array — #7651, allow dots in placeholder and block names — #7611, wrong array initialized, the same object cannot be used for multiple templates Easy Install pear install HTML_Template_IT-1.2.0 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.2.0 Download For manual installation only Release date: 2006-08-17 12:54 UTC Release state: beta Release uploaded by: dsp — Deprecate $callbackobject parameter in setCallbackFunction — Introduce $expandCallbackParameters parameter to setCallbackFunction to support callbacks that expect to get the parameters in a regular way, not as an array — #7651, allow dots in placeholder and block names Easy Install pear install HTML_Template_IT-1.1.4 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.1.4 Download For manual installation only Release date: 2006-04-11 21:16 UTC Release state: stable Release uploaded by: pajoye — #6084, fread raises warning when used with empty files — #7359, remove notices when a block is not yet defined — fix a bug introduced with some cleanup commit, in some cases, callbacks did not work anymore Easy Install pear install HTML_Template_IT-1.1.3 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.1.3 Download For manual installation only Release date: 2005-11-01 16:53 UTC Release state: stable Release uploaded by: pajoye — Change to the new BSD License (see http://www.opensource.org/licenses/bsd-license.php) Easy Install pear install HTML_Template_IT-1.1.2 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.1.2 Download For manual installation only Release date: 2005-10-28 07:15 UTC Release state: stable Release uploaded by: pajoye — Comply better with the coding standards (dufuz@php.net) — Fixed Bug #5774 ITX->buildFunctionlist, forced to use <> as delimiters instead of the user defined once (dufuz@php.net) — Fixed Bug #5642 Undefined variable: blockname (dufuz@php.net) Easy Install pear install HTML_Template_IT-1.1.1 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.1.1 Download For manual installation only Release date: 2005-08-20 18:27 UTC Release state: stable Release uploaded by: pajoye — fix #4590, case sensitive method name getFile fix — fix #1453, haltOnWarning fix, wrong property name called — fix #3952, return IT_OK on success in setOptions Easy Install pear install HTML_Template_IT-1.1 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.1 Download For manual installation only Release date: 2003-03-12 15:42 UTC Release state: stable Release uploaded by: pajoye — Added str_replace optionnal parsing (fixes problems with regular expression like ‘$’ symbols) (Alexey, pajoye) — Added preserve_data to substitute/preserve variables inside in datas already passed through setVariable (Alexey) A special thank to Alexey Borzov to provide a patch for his fixes Easy Install pear install HTML_Template_IT-1.0.0 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.0.0 Download For manual installation only Release date: 2002-09-13 01:26 UTC Release state: stable Release uploaded by: pajoye Easy Install pear install HTML_Template_IT-1.0 Pyrus Install php pyrus.phar install pear/HTML_Template_IT-1.0 Download For manual installation only Release date: 2002-09-01 11:54 UTC Release state: beta Release uploaded by: pajoye Initial independent PEAR release. Источник Saved searches Use saved searches to filter your results more quickly You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. License pear/HTML_Template_IT This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit Git stats Files Failed to load latest commit information. README.md HTML_Template_IT — Integrated Templates HTML_Template_IT is a templating engine designed to allow easy separation of concerns. It does this by clearly separating the presentational code from the PHP code. The presentation code may be of any format, however generally XML or HTML is used. This engine works on the foundation of blocks and placeholders. It uses the hierarchy of blocks to determine which presentational code is instantiated when blocks are parsed. The placeholders allow the insertion of «dynamic» information. There are two classes to use for templating. HTML_Template_IT is used for basic templating needs. HTML_Template_ITX gives you full power over the templating engine, allowing blocks to be added, and function callbacks to be used. For a PEAR installation that downloads from the PEAR channel: $ pear install pear/html_template_it For a PEAR installation from a previously downloaded tarball: $ pear install HTML_Template_IT-*.tgz For a PEAR installation from a code clone: For a local composer installation: To add as a dependency to your composer-managed application: $ composer require pear/html_template_it Run the tests from a local composer installation: Источник
  13. $removeEmptyBlocks = true
  14. $removeUnknownVariables = true
  15. $variablenameRegExp = ‘[\.0-9A-Za-z_-]+’
  16. Method Detail
  17. HTML_Template_IT (Constructor) [line 410]
  18. Parameters:
  19. Package Information: HTML_Template_IT
  20. Easy Install
  21. Pyrus Install
  22. Download
  23. Easy Install
  24. Pyrus Install
  25. Download
  26. Easy Install
  27. Pyrus Install
  28. Download
  29. Easy Install
  30. Pyrus Install
  31. Download
  32. Easy Install
  33. Pyrus Install
  34. Download
  35. Easy Install
  36. Pyrus Install
  37. Download
  38. Easy Install
  39. Pyrus Install
  40. Download
  41. Easy Install
  42. Pyrus Install
  43. Download
  44. Easy Install
  45. Pyrus Install
  46. Download
  47. Easy Install
  48. Pyrus Install
  49. Download
  50. Easy Install
  51. Pyrus Install
  52. Download
  53. Easy Install
  54. Pyrus Install
  55. Download
  56. Saved searches
  57. Use saved searches to filter your results more quickly
  58. License
  59. pear/HTML_Template_IT
  60. Name already in use
  61. Sign In Required
  62. Launching GitHub Desktop
  63. Launching GitHub Desktop
  64. Launching Xcode
  65. Launching Visual Studio Code
  66. Latest commit
  67. Git stats
  68. Files
  69. README.md
Читайте также:  Html передать параметры a get

Introduction

A template consists of text and special labeled blocks and placeholders. The content of blocks can be re-used and parsed multiple times with different placeholder values.

Placeholder

Placeholders can be defined in templates and are filled from PHP code with content. The format of placeholder up to version (1.1.x) is

Since version 1.2.x dots are allowed, too.

This means, the name of the placeholder can consist of upper- and lowercase letters, underscores and hypens. The name must be placed between curly brackets without any spaces. Valid names are i.e.:

Valid names since version 1.2.x

Blocks

Since version 1.2.x dots are allowed in block definitions

The rules for the block name are the same like for placeholders. In contrast to placeholders the spaces in the block markup are required.

The nesting of blocks is permitted, but be careful while parsing. You have to set and parse the deepest inner block first and then set and parse from inner to outer.

In IT the whole template file itself is nested in a meta block called » __global__ «. Most block-related functions use this block name as default.

Usage Example

$data = array
(
«0» => array( «Stig» , «Bakken» ),
«1» => array( «Martin» , «Jansen» ),
«2» => array( «Alexander» , «Merz» )
);

$tpl = new HTML_Template_IT ( «./templates» );

$tpl -> loadTemplatefile ( «main.tpl.htm» , true , true );

foreach( $data as $name ) foreach( $name as $cell ) // Assign data to the inner block
$tpl -> setCurrentBlock ( «cell» ) ;
$tpl -> setVariable ( «DATA» , $cell ) ;
$tpl -> parseCurrentBlock ( «cell» ) ;
>

// parse outter block
$tpl -> parse ( «row» );
>
// print the output
$tpl -> show ();

Источник

Class: HTML_Template_IT

Well there’s not much to say about it. I needed a template class that supports a single template file with multiple (nested) blocks inside and a simple block API.

Читайте также:  Jquery insert html after element

The Isotemplate API is somewhat tricky for a beginner although it is the best one you can build. template::parse() [phplib template = Isotemplate] requests you to name a source and a target where the current block gets parsed into. Source and target can be block names or even handler names. This API gives you a maximum of fexibility but you always have to know what you do which is quite unusual for php skripter like me.

I noticed that I do not any control on which block gets parsed into which one. If all blocks are within one file, the script knows how they are nested and in which way you have to parse them. IT knows that inner1 is a child of block2, there’s no need to tell him about this.

To add content to block1 you simply type:

To add content to block2 you would type something like:

This will result in one repition of block1 which contains two repitions of inner1. inner2 will be removed if $removeEmptyBlock is set to true which is the default.

  • Author: Ulf Wendel
  • Link:http://pear.php.net/packages/HTML_Template_IT
  • Access: public
  • License: BSD

Class Variables

$blocknameRegExp = ‘[\.0-9A-Za-z_-]+’

RegExp matching a block in the template.

Per default «sm» is used as the regexp modifier, «i» is missing. That means a case sensitive search is done.

$clearCache = false

$clearCacheOnParse = false

Clear the variable cache on parse?

If you’re not an expert just leave the default false. True reduces memory consumption somewhat if you tend to add lots of values for unknown placeholder.

$closingDelimiter = ‘>’

Last character of a variable placeholder ( _ ).

$err = array()

Contains the error objects

$openingDelimiter = ‘

First character of a variable placeholder ( _ ).

$removeEmptyBlocks = true

Controls the handling of empty blocks, default is remove.

$removeUnknownVariables = true

Controls the handling of unknown variables, default is remove.

$variablenameRegExp = ‘[\.0-9A-Za-z_-]+’

RegExp matching a variable placeholder in the template.

Per default «sm» is used as the regexp modifier, «i» is missing. That means a case sensitive search is done.

Method Detail

HTML_Template_IT (Constructor) [line 410]

Make sure that you call this constructor if you derive your template class from this one.

Parameters:

string $root File root directory, prefix for all filenames given to the object.
mixed $options Unknown

Источник

Package Information: HTML_Template_IT

Changes since last stable release (1.2.1):
— Add support for pear package 2.0 format
— Remove support for pear package 1.0 format
— Fix bug #9501, doller signs disapear if preg_match is used.
— Fix bug #9783, don’t remove variable which values follow the variable pattern
To allow backwards compatbility an option preserve_input is added.
If it is false, the old behaviour will be used and therefore those values will be deleted.
Default is true, so new behaviour.
— Fix bug #9853, problems with dots in placeholders or blocknames
— Fix bug #13935, docblock is wrong
— Fix bug #17129
— Add option ‘preserve_input’ to only remove unkown variable that were present
during setTemplate or loadTemplatefile
which is the behaviour before 1.3.0a1
— Improved PHPCS (Request #15039)
— Added unit tests
— Fixed unit tests

Easy Install

pear install HTML_Template_IT-1.3.0a3

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.3.0a3

Download

For manual installation only

Release date: 2010-03-01 05:14 UTC
Release state: alpha
Release uploaded by: gregorycu

Easy Install

pear install HTML_Template_IT-1.3.0a2

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.3.0a2

Download

For manual installation only

Release date: 2010-02-16 02:13 UTC
Release state: alpha
Release uploaded by: doconnor

Easy Install

pear install HTML_Template_IT-1.3.0a1

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.3.0a1

Download

For manual installation only

Release date: 2008-12-27 02:13 UTC
Release state: alpha
Release uploaded by: doconnor

— Add support for pear package 2.0 format
— Remove support for pear package 1.0 format
— Fix bug #9501, doller signs disapear if preg_match is used.
— Fix bug #9783, don’t remove variable which values follow the variable pattern
To allow backwards compatbility an option preserve_input is added.
If it is false, the old behaviour will be used and therefore those values will be deleted.
Default is true, so new behaviour.
— Fix bug #9853, problems with dots in placeholders or blocknames
— Add option ‘preserve_input’ to only remove unkown variable that were present during setTemplate or lodaTemplatefile
which is the behaviour before 1.3.0a1
— Fix bug #13935 — docblock is wrong
— Improved PHPCS (Request #15039)

Easy Install

pear install HTML_Template_IT-1.2.1

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.2.1

Download

For manual installation only

Release date: 2006-08-25 10:11 UTC
Release state: stable
Release uploaded by: dsp

— Deprecate $callbackobject parameter in setCallbackFunction
— Introduce $expandCallbackParameters parameter to setCallbackFunction to support
callbacks that expect to get the parameters in a regular way, not as an array
— #7651, allow dots in placeholder and block names
— #7611, wrong array initialized, the same object cannot be
used for multiple templates

Easy Install

pear install HTML_Template_IT-1.2.0

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.2.0

Download

For manual installation only

Release date: 2006-08-17 12:54 UTC
Release state: beta
Release uploaded by: dsp

— Deprecate $callbackobject parameter in setCallbackFunction
— Introduce $expandCallbackParameters parameter to setCallbackFunction to support
callbacks that expect to get the parameters in a regular way, not as an array
— #7651, allow dots in placeholder and block names

Easy Install

pear install HTML_Template_IT-1.1.4

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.1.4

Download

For manual installation only

Release date: 2006-04-11 21:16 UTC
Release state: stable
Release uploaded by: pajoye

— #6084, fread raises warning when used with empty files
— #7359, remove notices when a block is not yet defined
— fix a bug introduced with some cleanup commit, in some cases,
callbacks did not work anymore

Easy Install

pear install HTML_Template_IT-1.1.3

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.1.3

Download

For manual installation only

Release date: 2005-11-01 16:53 UTC
Release state: stable
Release uploaded by: pajoye

— Change to the new BSD License
(see http://www.opensource.org/licenses/bsd-license.php)

Easy Install

pear install HTML_Template_IT-1.1.2

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.1.2

Download

For manual installation only

Release date: 2005-10-28 07:15 UTC
Release state: stable
Release uploaded by: pajoye

— Comply better with the coding standards (dufuz@php.net)
— Fixed Bug #5774 ITX->buildFunctionlist, forced to use <> as delimiters
instead of the user defined once (dufuz@php.net)
— Fixed Bug #5642 Undefined variable: blockname (dufuz@php.net)

Easy Install

pear install HTML_Template_IT-1.1.1

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.1.1

Download

For manual installation only

Release date: 2005-08-20 18:27 UTC
Release state: stable
Release uploaded by: pajoye

— fix #4590, case sensitive method name getFile fix
— fix #1453, haltOnWarning fix, wrong property name called
— fix #3952, return IT_OK on success in setOptions

Easy Install

pear install HTML_Template_IT-1.1

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.1

Download

For manual installation only

Release date: 2003-03-12 15:42 UTC
Release state: stable
Release uploaded by: pajoye

— Added str_replace optionnal parsing (fixes problems
with regular expression like ‘$’ symbols) (Alexey, pajoye)
— Added preserve_data to substitute/preserve variables inside
in datas already passed through setVariable (Alexey)
A special thank to Alexey Borzov to provide a patch for his fixes

Easy Install

pear install HTML_Template_IT-1.0.0

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.0.0

Download

For manual installation only

Release date: 2002-09-13 01:26 UTC
Release state: stable
Release uploaded by: pajoye

Easy Install

pear install HTML_Template_IT-1.0

Pyrus Install

php pyrus.phar install pear/HTML_Template_IT-1.0

Download

For manual installation only

Release date: 2002-09-01 11:54 UTC
Release state: beta
Release uploaded by: pajoye

Initial independent PEAR release.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

License

pear/HTML_Template_IT

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

HTML_Template_IT — Integrated Templates

HTML_Template_IT is a templating engine designed to allow easy separation of concerns. It does this by clearly separating the presentational code from the PHP code. The presentation code may be of any format, however generally XML or HTML is used. This engine works on the foundation of blocks and placeholders. It uses the hierarchy of blocks to determine which presentational code is instantiated when blocks are parsed. The placeholders allow the insertion of «dynamic» information. There are two classes to use for templating. HTML_Template_IT is used for basic templating needs. HTML_Template_ITX gives you full power over the templating engine, allowing blocks to be added, and function callbacks to be used.

For a PEAR installation that downloads from the PEAR channel:

$ pear install pear/html_template_it

For a PEAR installation from a previously downloaded tarball:

$ pear install HTML_Template_IT-*.tgz

For a PEAR installation from a code clone:

For a local composer installation:

To add as a dependency to your composer-managed application:

$ composer require pear/html_template_it

Run the tests from a local composer installation:

Источник

Оцените статью