Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates $this的Magento代码->;getChildHtml(';topContainer';);_Templates_Magento - Fatal编程技术网

Templates $this的Magento代码->;getChildHtml(';topContainer';);

Templates $this的Magento代码->;getChildHtml(';topContainer';);,templates,magento,Templates,Magento,我正在编写一个magento主题。我已启用路径提示,但在 调用$this->getChildHtml('topContainer')的标题 不会显示任何路径提示。我怎样才能知道是哪个 .phtml文件在进行上述调用时加载,因此 我可以创建适当命名和定位的 .phtml自定义文件?topContainer是一个“页面/html\u包装器”块。 这意味着没有与之关联的模板文件 此块的作用是在html元素中呈现其所有子块。 看看“app/code/core/Mage/Page/Html/Wrapper

我正在编写一个magento主题。我已启用路径提示,但在 调用
$this->getChildHtml('topContainer')的标题
不会显示任何路径提示。我怎样才能知道是哪个
.phtml文件在进行上述调用时加载,因此
我可以创建适当命名和定位的
.phtml自定义文件?

topContainer是一个“页面/html\u包装器”块。 这意味着没有与之关联的模板文件

此块的作用是在html元素中呈现其所有子块。 看看“app/code/core/Mage/Page/Html/Wrapper.php”中的_-toHtml()方法

真诚地

乔纳森

---更多解释:

您可以在以下内容中查看一个完美的示例:

  • layout/customer.xml(在基本主题中)
  • layout/sales.xml(在基本主题中)
  • 您有一个类似的块:

    <block type="page/html_wrapper" name="my.account.wrapper" translate="label">
    
    
    
    该区域将呈现所有其他客户帐户块。 为了将块放在这个区域中,您必须创建一个属性“name”设置为“wrapper”名称的“reference”节点

    例如,如果您查看(inside sales.xml)到“sales\u order\u view”句柄,您将看到
    ,在该节点内还有其他块

    这些其他块是经典块(核心/模板),它们具有模板文件

    因此,您可以将“页面/html\u包装器”块与“核心/文本\u列表”块进行比较。 唯一的区别是第一个将呈现的子块包装到html元素中


    看看上面提到的两个文件,它们将对您有很大帮助。

    您好,我仍然不了解这些没有相关模板文件的块是如何工作的。有人能再解释一下吗?我已经用更多的细节更新了我的awnser,希望他们能帮助你。重要的是要注意,你应该参考
    top.container
    ,而不是
    topContainer
    ——前者是块的名称,而后者只是一个别名。