Monthly Archives: August 2006

HTML_Template_IT 1.2.1 stable released

Well, no bugs were submitted and real application tests (thanks to thorsten) as well as unit tests were passed so we released [b]HTML_Template_IT 1.2.1 stable[/b] today. [b]1.2.1 stable[/b] is exactly the same as [b]1.2.0 beta[/b], but marked as stable.
You can install HTML_Template_IT by using the following command:

# pear install HTML_Template_IT

or upgrade it using

# pear upgrade HTML_Template_IT

A detailed look of the changes since 1.1.4 stable can be found here.

HTML_Template_IT 1.2.0 beta released

Today we released the 1.2.0 beta of [b]HTML_Template_IT[/b].
As I mentioned, an option was added to HTML_Template_ITX::setCallbackFunction() to determine if call_user_func or call_user_func_array is used to call the callback function.
Example:[php]
function _numberFormatCallback($float, $decimals) {
return number_format($float, $decimals);
}

$tpl = new HTML_Template_ITX();
$tpl->setTemplate(‘callback:func_numberFormat(1.5, 2)’);
$tpl->setCallbackFunction(‘numberFormat’, ‘_numberFormatCallback’, ”, true);
$tpl->performCallback();
$tpl->show();
// prints “callback:1.50″
[/php]
Look a the line:
[php]
$tpl->setCallbackFunction(‘numberFormat’, ‘_numberFormatCallback’, ”, true);
[/php]
If last parameter ist true callback uses the expanded parameters, otherwise it uses the old way and passes only one array containing the parameters. The following example demonstrates the old behaviour:
[php]
// before 1.2 beta we have to do that:
function _numberFormatCallback($arr) {
return number_format($arr[0], $arr[1]);
}

$tpl = new HTML_Template_ITX();
$tpl->setTemplate(‘callback:func_numberFormat(1.5, 2)’);
$tpl->setCallbackFunction(‘numberFormat’, ‘_numberFormatCallback’, ”, false);
$tpl->performCallback();
$tpl->show();
// prints “callback:1.50″
[/php]
Also Pierre fixed the #7611 bug and I implemented the feature request #7651 to allow dots in placeholders and blocks. An example for the new blocks:


{a.new.placeholder}

Old placeholder pattern:

[0-9A-Za-z_-]+

New placeholder pattern:

[\.0-9A-Za-z_-]+

We also decided to deprecate $callbackobject parameter in HTML_Template_ITX::setCallbackFunction(). This paramter takes the name of a global defined object as a string and calls the callback method on that object. This can also be done using array($object, ‘callbackFunctionName’) and it’s more like a dirty hack than good code to use this parameter.

Furthermore API docs were cleaned a little bit.

Install the beta:

# pear -d preferred_state=beta install HTML_Template_IT

If no bugs will be found we will release [b]1.2.0 stable[/b] in about one or two weeks.

A few words about charsets, font, collation.

Just as a bookmark:
Kristian Köhntopp has written a informative blog entry about the MySQL 4.1 collation support showing how to handle different encodings of characters (german language).