首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何将我的Magento迷你搜索表单移动到模板标题中的另一个位置?

如何将我的Magento迷你搜索表单移动到模板标题中的另一个位置?
EN

Stack Overflow用户
提问于 2012-08-29 15:51:21
回答 2查看 17.2K关注 0票数 3

我正在构建我的第一个定制的Magento主题。这是缓慢的,但它正在进行。我摆脱了最初在主页上持有迷你搜索表单的酒吧,而是希望将搜索表单放在我的新标题中。

以下是header.phtml中我的头的代码

代码语言:javascript
运行
复制
<div id="header">
<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>
    <div id="header-top">
    <?php echo $this->getChildHtml('topSearch') ?>
    <?php echo $this->getChildHtml('topLinks') ?>
    </div>
    <?php echo $this->getChildHtml('topMenu') ?>
</div>

但是搜索表单没有呈现。以下是有关的网站:

http://s1.mynewsitereview.com/

非常感谢!

EN

Stack Overflow用户

发布于 2013-10-20 00:59:19

我知道这个问题很老,但我会把我的答案发出来,希望它能帮助其他人解决同样的问题。

在我的例子中,我需要在我的页脚上另一个搜索表,所以我打开了

app/desing/frontend/base/default/layout/catalogsearch.xml

并复制:

代码语言:javascript
运行
复制
<reference name="header">
        <block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
    </reference>

to:默认标记中的app/desing/frontend/my-theme/my-theme/layout/local.xml

代码语言:javascript
运行
复制
<reference name="header">
        <block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
    </reference>
</default><!-- just to give a idea of the position of where you should paste this code -->

然后我把它改成:

代码语言:javascript
运行
复制
<reference name="footer">
        <block type="core/template" name="footer.search" as="footerSearch" template="catalogsearch/form.mini.phtml"/>
    </reference>
</default>

然后在我的页脚文件中调用:

代码语言:javascript
运行
复制
<?php echo $this->getChildHtml('footerSearch') ?>

基本上,您必须告诉您的主题需要在哪里使用本地xml获取“footerSearch”,然后可以将其称为thought。

票数 4
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12181827

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档