[PHP-users 5445] IntegratedTemplate::touchBlockについて

Kiryu Tsukimiya php-users@php.gr.jp
Fri, 15 Feb 2002 18:47:43 +0900


月宮です。
IntegratedTemplate::touchBlockで質問があります。
現在、php4.1.1にて以下のようなコードを書いたのですが
意図したとおりに動作しません。
--- template.html ---
<table border="0" cellpadding="3" cellspacing="1" width="100%">
<!-- BEGIN bMonth -->
 <tr bgcolor="#ffbbdd"> 
  <td height="50" class="table_title" bgcolor="#FFBAC6" width="100"> 
   <div align="center">{hMonth}月</div>
  </td>
<!-- BEGIN bDay -->
  <td align="center" class="table10" height="50" bgcolor="#FFFFFF"
width="30"> 
   <div align="center">{hDay}</div>
  </td>
<!-- END bDay -->
 </tr>
<!-- END bMonth -->
</table>
--- template.html ここまで ----
--- template.php ---
<?php
	require_once "HTML/IT.php";
	$tmpl = new IntegratedTemplate(".");
	$tmpl->loadTemplatefile("template.html",true,true);
	$day = array("1","3","5");
	$tmpl->touchBlock("bDay");
	for ( $month = 0; $month < 12;$month++){
		for ( $i = 0; $i < 20; $i++){
			$tmpl->setCurrentBlock("bDay");
			$tmpl->setVariable("hDay",$day[$i]);
			$tmpl->parseCurrentBlock("bDay");
		}
		$tmpl->setCurrentBlock("bMonth");
		$tmpl->setVariable("hMonth",$month+1);
		$tmpl->parseCurrentBlock("bMonth");
	}
	$tmpl->show();
?>
---template.php ここまで---

望む動作としては、$dayに値が入っていようがいまいが20列表示。
そして1月〜12月まで12行表示。

というものなのですが、なぜか13行表示されてしまいます。
(最後に何も値が入っていない行が出てしまいます。)

どなたか、わかる方いたらよろしくお願いします。


---
月宮紀柳 <php@angelicwing.net>