touchBlock() – Preserves the block even if empty blocks should be removed.


require_once 'HTML/Template/Sigma.php';

mixed HTML_Template_Sigma::touchBlock ( string $block )


Sometimes you have blocks that should be preserved although they are empty (no placeholder replaced). Think of a shopping basket. If it's empty you have to show a message to the user. If it's filled you have to show the contents of the shopping basket. Now where to place the message that the basket is empty? It's not a good idea to place it in you application as customers tend to like unecessary minor text changes. Having another template file for an empty basket means that one fine day the filled and empty basket templates will have different layouts.

So blocks that do not contain any placeholders but only messages like "Your shopping basked is empty" are introduced. Now if there is no replacement done in such a block the block will be recognized as "empty" and by default ($removeEmptyBlocks = true) be stripped off. To avoid this you can call touchBlock()


string $block

block name

Return value

return SIGMA_OK on success, error object on failure


see HTML_Template_Sigma::$removeEmptyBlocks


Possible PEAR_Error values
Error code Error message Reason Solution
SIGMA_BLOCK_NOT_FOUND Cannot find block '$block' There is no block $block in the template Check the block name spelling, check whether you added all the necessary blocks to the template


This function can not be called statically.

Prints a block with all replacements done. (Previous) HTML_Template_Xipe (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.