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

s_ichihara php-users@php.gr.jp
Thu, 15 Feb 2001 22:01:05 +0900


市原@池袋ヽ(・∀・)/イイ です。
取り合えず理屈はわからないのですが

--template.html--
<html><head></head><body>
<table border="0" cellpadding="3" cellspacing="1" width="100%">

<!-- BEGIN bLast -->
 <!-- BEGIN bMonth -->
 <tr bgcolor="#ffbbdd">
  <td height="50" class="table_title" bgcolor="#FFBAC6" width="100">
   <div align="center">{hMonth}月</div>
  </td>
<!-- END bMonth -->
<!-- BEGIN bDay -->
  <td align="center" class="table10" height="50" bgcolor="#FFFFFF"
width="30">
   <div align="center">{hDay}</div>
  </td>
<!-- END bDay -->
 {hLast}
<!-- END bLast -->


</table>
</body>
</html>

--template.php--
<?php
require_once "HTML/IT.php";
$tmpl = new IntegratedTemplate("./");
$tmpl->loadTemplatefile("./test/template.html");
$day = array("1","3","5");
$tmpl->touchBlock("bDay");
for ( $month = 0; $month < 12;$month++){
$tmpl->setCurrentBlock("bMonth");
$tmpl->setVariable("hMonth",$month+1);
$tmpl->parseCurrentBlock("bMonth");

for ( $i = 0; $i < 20; $i++){
$tmpl->setCurrentBlock("bDay");
$tmpl->setVariable("hDay",$day[$i]);
$tmpl->parseCurrentBlock("bDay");
}

$tmpl->setCurrentBlock("bLast");
$tmpl->setVariable("hLast","</tr>");
$tmpl->parseCurrentBlock("bLast");
}
$test = $tmpl->get();
print $test;
?>
でやってみましたらできました。
はずしていたら申し訳ございません。