Magento如何移动模板标志到左列


Magento how to move template logo to left column?

我想知道如何改变我的标志在magento的位置?

默认情况下,徽标在标题中,但我想将其移动到左列,我读到我需要更改XML文件中的块等,但我不知道要更改哪个文件。我不想用CSS来修复它,我想用Magento的logo功能。

下面是我想移动到左列模板的代码:

<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" 
class="logo">
<strong><?php echo $this->getLogoAlt() ?></strong>
<img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" />
</a>

在模板中$this引用了一个特定的块,因此在另一个模板中使用相同的代码不起作用。getLogoSrc()getLogoAlt()方法仅适用于Mage_Page_Block_Html_Header。解决方案是在左列中创建其中一个块,但使用自定义模板。

在XML布局文件中添加以下内容:

<default>
    <reference name="left">
        <block type="page/html_header" name="logo">
            <!-- Cannot set "template" param since header block sets it's own in constructor -->
            <action method="setTemplate"><template>page/html/logo.phtml</template></action>
        </block>
    </reference>
</default>

将模板代码放置在主题中,设置为template/page/html/logo.phtml。左列是一个"文本列表",因此会自动输出它的所有内容,新块将为您呈现。