在template类中加一函数 如下:  function exist_block($parent, $handle) {
    if (!$this->loadfile($parent)) {
      $this->halt("subst: unable to load $parent.");
      return false;
    }
    if ($name == "")
      $name = $handle;    $str = $this->get_var($parent);
    $reg = "/<!--\s+BEGIN $handle\s+-->.*\n\s*<!--\s+END $handle\s+-->/sm";
    if ereg($reg, $str) {
return true;
    }else{
return false;
    }
  }$parent 为set_file的句柄,$handle 为block的名字