Home » HTML » HTML_Template_IT » Bug #1474
Cannot find this block 'blockname' always true
Details
| Submitted | 2004-05-23 01:03 UTC |
|---|---|
| From | rolson at alpdev dot com |
| Assigned | pajoye |
| Status | No Feedback |
| Package | HTML_Template_IT |
| PHP Version | 4.3.6 |
| OS | FreeBSD 5.2 |
| Roadmaps | (Not assigned) |
Comments
[2004-05-23 01:03 UTC] rolson at alpdev dot com
Description:
------------
Package Version: 1.1
There is always a PEAR error raised when parsing a block due to what I believe is a logic error in the error handling. Either that or my understanding of how this templating system works is wrong.
All of the code examples provided in the code and documentation show that you create a new block by calling the setCurrentBlock method, however the very first thing that function does is check to see if that block exists and if not raise an error.
So there is no way to get around an error being raised that states "Cannot find this block 'blockname'".
Reproduce code:
---------------
foreach($admin_tabs as $aidx => $aval) {
if($console->adminTab == $aval['admin_tab_id']) {
$tpl->setCurrentBlock('tab_item_selected');
$tpl->setVariable('PAGE_ID', $Site['PageInfo']['content_id']);
$tpl->setVariable('ADMIN_TAB_ID', $aval['admin_tab_id']);
$tpl->setVariable('ADMIN_TAB_NAME', $aval['name']);
$tpl->parseCurrentBlock();
} else {
$tpl->setCurrentBlock('tab_item');
$tpl->setVariable('PAGE_ID', $Site['PageInfo']['content_id']);
$tpl->setVariable('ADMIN_TAB_ID', $aval['admin_tab_id']);
$tpl->setVariable('ADMIN_TAB_NAME', $aval['name']);
$tpl->parseCurrentBlock();
}
}
$tpl->show();
Expected result:
----------------
I don't expect there to be an error raised about being unable to find the block
Actual result:
--------------
Cannot find this block"tab_item_selected':
Cannot find this block"tab_item':
Cannot find this block"tab_item':
And then it displays the tab items anyway...
[2004-05-23 18:36 UTC] pierre at dotgeek dot org
Hello,
Please provide a script and its template (or include a simple template in a string) without any external (and unknown) data.
It should help to either understand, reproduce or fix your problems.
Thanks for this report,
--Pierre