|
Procedural File: XT.php
Source Location: Program_Root/XML/XT.php
Page Details:
XT is an XML-based template engine. For reference information, see the http://www.sitellite.org/index/news-app/section.Templates.
Change History New in 1.2: - Added support for xmlchar tags as a means of displaying HTML entities that
are not supported by the XML spec, without having to declare an HTML doctype.
For more information see http://xmlchar.sf.net/ and
http://www.w3.org/TR/REC-html40/sgml/entities.html for a list of HTML
entities.
- Added global functions as aliases of the main public methods. These simply
call the methods on a global XT object named $tpl. They are: template_xt(),
template_messy(), template_validate(), and template_wrap().
- Passed the default object to the $intl->get() calls so that {tag}-style
substitutions can be made.
- Added aliases xt:translate and xt:i18n that point to xt:intl.
- Added aliases xt:elsif that points to xt:elseif.
- Fixed a few bugs regarding xt:content and xt:replace attributes, and the
xt:condition, xt:if, xt:elseif, and xt:else tags.
New in 1.4: - Added an xt:cache tag which allows you to cache pieces of a template for
improved performance.
- Added an ignoreUntilLevel() method which controls the private
$_ignoreUntilLevel property.
- Added the $cacheLocation, $cacheDuration, and $cacheCount properties to
work with the new xt:cache tag.
- Added the $isHtml property to tell the xt:intl tag whether or not to add
an HTML span tag to its output.
New in 1.6: - Added xt:comment and xt:note tags (xt:note is an alias to xt:comment), so
that comments can be added to templates that will be retained in the
rendered output (since normal xml comments are stripped by the
xml_parse_into_struct() function). For comments that should not be
retained, please use ordinary xml comments.
- Added start, end, and length as attributes of loop iterators.
- Added _header_handler(), makeToc(), and support for automatic generation
of tables of contents for HTML content. Also added the $toc and $buildToc
properties.
New in 1.8: - Added the ability to call XT tags (attributes too? not sure) using
<xt-tagname /> as well as with the <xt:tagname /> namespace. This feature
helps when you want to render XT tags with CSS, since namespaces in CSS are
not supported by any browser (except Opera 7 apparently) at present.
New in 2.0: - Added the ability to use inline expressions in any tag attribute, for example:
<a href="${site/prefix}/index/news"><xt:intl>News</xt:intl></a>
This drastically reduces the amount of code needed to implement common
expressions, and really increases the flexibility of the language.
- Fixed a bug where XT string expressions that began with an inline expression
(for example: <h1 xt:content="string: ${site/domain} - welcome">welcome</h1>)
would cause the inline expression to disappear.
- Changes to PHPShorthand have improved the stability of the php expression type,
especially in the area of respecting quoted strings.
New in 2.2: - Fixed a bug where tags that contained no children and used the xt:condition
attribute would improperly set the $ignoreUntilLevel variable, causing
unpredictable rendering below.
New in 2.4: - Added a new include type "virtual" which includes a relative URL from the
web site document root, allowing the inclusion of CGI scripts and other
types of dynamic content directly into the template. This would be the
equivalent of the PHP code:
include ('http://www.example.com/cgi-bin/script_name.cgi'); 1 <?php 2 3 loader_import ('saf.XML.XT'); 4 5 $tpl = new XT ('inc/html', XT_DEFAULT_PREFIX); 6 7 $tpldata = ''; 8 9 if ($tpl->validate ($tpldata)) { 10 echo $tpl->fill ( 11 $tpldata, 12 array ( 13 'foo' => 'Testing...', 14 ) 15 ); 16 } else { 17 echo 'Error: ' $tpl->error . ' on line ' . $tpl->err_line; 18 } 19 20 ? >
Tags:
XT_DEFAULT_PREFIX [line 134]
XT_POST_PREFIX [line 137]
template_bind [line 3292]
void template_bind(
mixed $path, mixed $data)
|
|
template_bind_attr [line 3296]
void template_bind_attr(
mixed $path, mixed $attr, mixed $value)
|
|
template_convert_entities [line 3284]
void template_convert_entities(
mixed $data)
|
|
template_error [line 3272]
template_err_colnum [line 3280]
void template_err_colnum(
)
|
|
template_err_line [line 3276]
void template_err_line(
)
|
|
template_messy [line 3260]
void template_messy(
mixed $tpl, [mixed $obj = ''], [mixed $carry = false])
|
|
template_toc [line 3288]
void template_toc(
[mixed $title = ''])
|
|
template_validate [line 3264]
void template_validate(
mixed $data)
|
|
template_wrap [line 3268]
void template_wrap(
mixed $data)
|
|
template_xt [line 3256]
void template_xt(
mixed $tpl, [mixed $obj = ''], [mixed $carry = false])
|
|
|