如果你有一个公用的html代码块单独存放在很多个phtml文件,如何不创建对应的block文件就使其被调用?

其实可以使用系统的内置的Block:core/tempate,基本方法如下:
在layout文件中可能定义如下
<reference name=”content”>
  <block type=”core/template” name=”yourName” template=”your_phtml_file”/>
</reference>

顺便提及一下Block的一般传值方法:
如果想传一个属性如:product传值为mp3到phtml文件中,上述标签修改为
<reference name=”content”>
  <block type=”core/template” product=”mp3″ name=”yourName” template=”your_phtml_file”/>
</reference>
在phtml中,简单使用$this->getProduct();即可输出mp3.
如果传值是动态的,可能最好的传值机会是在controller代码中,代码例如下:

$this->getLayout()->getBlock(‘yourName’)->setProduct(‘mp3’);  
// yourName是在layout中声明的block name