和我以前发的那种方法在本质上没有区别。
建立四个文件:total.class.php
test.php
test.tpl.phptotal.class.php内容如下:class display_t
{
  function head(){
     require('head.php');
  }
  function foot(){
     require('foot.php');
  }
}
test.php内容如下:
require('total.class.php');
class display extends display_t
{
   function somecontents(){
      return 'somecontents';
   }
}
require('test.tpl.php');
$display=new display;test.tpl.php内容如下:
<html>
<head></head>
<body>
<?php $display->head(); ?><?php echo $display->somecontents();?><?php $display->foot();?>
</body>
</html>