0
我使用PEAR ITX添加模板。我的问题是,前2次($ number> 2)条件匹配,$ fileName2添加成功,块显示为预期;但是当第三次($ number == 2)条件匹配但$ fileName1看起来像加载失败时,它不显示任何东西。下面是我的示例代码:PHP Pear ITX添加和替换块文件
$template = new HTML_Template_ITX("./templates");
$template->loadTemplatefile($maintemplate,true,true);
while($row = mysql_fetch_array($result))
{
if($number==2)
{
$template->addBlockFile("CANDIDATES","CAN",$fileName1);|
$template->setCurrentBlock("CAN");
//do anything i need
}else if($number>2) //first 2 times condition match, everything works well
{
$template->addBlockFile("CANDIDATES","CAN",$fileName2);
$template->setCurrentBlock("CAN");
//do anything i need
}
$template->setCurrentBlock("MAIN");
$template->parseCurrentBlock();
}
这种情况可能相反,如果第一次的2倍条件匹配($号== 2),然后第三次条件匹配($号> 2),但问题仍然是存在。
我发现的是replaceBlockfile(),我试过但不起作用。任何人都可以告诉我这是什么错误?谢谢。