Magento 1.7.0.2
我有模板大师安装的简易目录图像。我想让标题、RSS 链接、描述等出现在这个模块和下面列出的产品上方。
因此,我将 view.phtml 拆分为 title.ptmhl 和 view.phtml 并且想要以下布局。
标题.phtml
简易目录图像
视图.phtml
我的 title.phtml 位于 catalog/category/title.phtml 如下:
<?php
$_helper = $this->helper('catalog/output');
$_category = $this->getCurrentCategory();
$categoryName = $this->htmlEscape($_category->getName());
$_imgHtml = '';
if ($_imageUrl = $_category->getImageUrl()) {
$_imgHtml = '<img src="'.$_imageUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" />';
$_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
}?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<div class="page-title category-title">
<?php if($this->IsRssCatalogEnable() && $this->IsTopCategory()): ?>
<a href="<?php echo $this->getRssLink() ?>" class="link-feed right" title="<?php echo sprintf($this->__('Subscribe to the %s RSS Feed'), $categoryName) ?>" target="_blank"><?php echo sprintf($this->__('Subscribe to %s RSS Feed'), $categoryName) ?></a>
<?php endif; ?>
<h2><?php echo $_helper->categoryAttribute($_category, $this->htmlEscape($_category->getName()), 'name') ?></h2>
</div>
<?php if($_imgHtml): ?>
<p><?php echo $_imgHtml?></p>
<?php endif; ?>
<?php if($_description=$_category->getDescription()): ?>
<p class="category-description std"><?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?></p>
<?php endif; ?>
</div>
view.phtml 已被更改为排除上述“page-title category-title”类的所有实例。
我尝试在 catalog.xml 中引用 title.phtml,如下所示
<reference name="content">
<block type="catalog/category_title" name="category.title" template="catalog/category/title.phtml">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
title.phtml 不显示。