【问题标题】:prestashop top menuprestashop 顶部菜单
【发布时间】:2012-12-13 13:53:32
【问题描述】:

我为 prestashop 构建了一个主题,我想更改菜单的 html 结构。 实际顶部菜单位于modules/blocktopmenu/blocktopmenu.tpl

{if $MENU != ''}
</div>

<!-- Menu -->
<div class="sf-contener clearfix">
    <ul class="sf-menu clearfix">
        {$MENU}
        {if $MENU_SEARCH}
            <li class="sf-search noBack" style="float:right">
                <form id="searchbox" action="{$link->getPageLink('search')}" method="get">
                    <p>
                        <input type="hidden" name="controller" value="search" />
                        <input type="hidden" value="position" name="orderby"/>
                        <input type="hidden" value="desc" name="orderway"/>
                        <input type="text" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|escape:'htmlall':'UTF-8'}{/if}" />
                    </p>
                </form>
            </li>
        {/if}
    </ul>
    <div class="sf-right">&nbsp;</div>

    <!--/ Menu -->
{/if}

如何编辑{$MENU} html 结构?

【问题讨论】:

    标签: php smarty prestashop


    【解决方案1】:

    在同一个模块中,在 .php 文件 modules/blocktopmenu/blocktopmenu.php smarty $MENU 变量被赋值 $this-&gt;smarty-&gt;assign('MENU', $this-&gt;_menu);

    所以你需要在blocktopmenu.php中改变$this->_menu的值(需要改变什么,因为这个属性中有很多html代码)

    【讨论】:

    • 您好,感谢您的回答,但我不想编辑任何模块,只是主题
    【解决方案2】:

    显然没有编辑模块就无法编辑顶部菜单, 我找到了一个聪明的replace函数的小解决方案

    类似的东西

    {$HOOK_TOP|replace:'sf-contener':''|replace:'sf-menu':'ftopMenu left'|replace:'id="header_links"':'id="ftopright" class="right"'} 
    

    你也可以使用一些 jQuery 技巧

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-20
      • 1970-01-01
      • 1970-01-01
      • 2019-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-17
      相关资源
      最近更新 更多