HTML_Template_IT::touchBlock() -- preserve empty block
Описание
Preserves an empty template block, even if $removeEmptyBlocks is TRUE and
no substition of placeholders took place.
Возвращаемое значение
boolean -
TRUE, if block was found, otherwise IT_Error.
Пример
Пример 42-1. Template - login.tpl.htm <html>
<body>
<!-- BEGIN login_successfull -->
You have logged in successfully!
<!-- END login_successfull -->
<!-- BEGIN login_failed -->
Login failed
<!-- END login_failed -->
</body>
</html> |
|
Пример 42-2. Script <?php
require_once "HTML/Template/IT.php";
// Remove blocks with no placeholders, or no placeholders set ($removeEmptyBlocks=true)
$tpl->loadTemplatefile("login.tpl.htm", true, true);
// hypothetical
if (login_successfull($username, $password)) {
// print login_successfull block.
// login_failed is removed, due to $removeEmptyBlocks = true
$tpl->touchBlock("login_successfull");
} else {
$tpl->touchBlock("login_failed");
}
$tpl->show();
?> |
|
Заметка
Эта функция не должна вызываться статически.
HIVE: All information for read only. Please respect copyright! |
|