【问题标题】:Magento not showing Custom Template Page contentMagento 不显示自定义模板页面内容
【发布时间】:2013-05-29 04:53:13
【问题描述】:

我创建了 4 个用于非产品内容的 CMS 页面模板。我已将模板文件上传到: app/design/frontend/default/MYTHEME/template/page/ 目录。我上传的文件是现有 1column.phtml 文件的副本,但是当我从 Design->Layout 下拉菜单中选择该页面模板并尝试预览页面时,我得到一个空白页面,没有错误,什么也没有。如果我选择 1column 页面选项,内容会正确显示。

这是我的配置文件

代码/本地/FL/CorporateTemplates/etc/config.xml

<?xml version="1.0"?>
<config>
    <global>
        <page>
            <layouts>

                <corporate_template_lithograph>
                    <label>Corporate Template - Lithograph</label>
                    <template>page/corp-lithograph.phtml</template>
                </corporate_template_lithograph>

                <corporate_template_wideformat>
                    <label>Corporate Template - Wide Format</label>
                    <template>page/corp-wideformat.phtml</template>
                </corporate_template_wideformat>

                <corporate_template_packaging>
                    <label>Corporate Template - Packaging</label>
                    <template>page/corp-packaging.phtml</template>
                </corporate_template_packaging>

                <corporate_template_photography>
                    <label>Corporate Template - Photography</label>
                    <template>page/corp-photograph.phtml</template>
                </corporate_template_photography>

            </layouts>
        </page>
    </global>
</config>

这是我的 etc/module 文件

<config>
    <modules>
        <FL_CorporateTemplates>
            <active>true</active>
            <codePool>local</codePool>
        </FL_CorporateTemplates>
    </modules>
</config>

【问题讨论】:

  • 你检查异常日志和 PHP 错误了吗?因此,您似乎在下拉列表中获得了新模板,但没有呈现。您可以发布其中一个 phtml 文件的内容吗?
  • 你刷新缓存了吗?

标签: magento magento-1.6


【解决方案1】:

您需要为每个人定义一个layout_handle:

<global>
    <!-- snip -->
    <page>
        <layouts>
            <corporate_template_lithograph>
                <label>Corporate Template - Lithograph</label>
                <template>page/corp-lithograph.phtml</template>
                <layout_handle>corporate_template_lithograph</layout_handle> <!-- arbitrary value -->
            </corporate_template_lithograph>
        <layouts>
    <page>
<global>

这允许您在模块的布局 XML 文件中定义将与此页面布局设置一起使用的布局更新。有关示例,请参阅app/design/frontend/base/default/layout/page.xml。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多