• 修改首页导航菜单的位置


    将首页的导航菜单移入到 banner下面的方法:

    进入后台,在cms-page-设计:

    右边:

    1.<reference name="content">
    2.<block type="catalog/product_new" name="home.catalog.product.new" template="catalog/product/tabMenu.phtml" after="cms_page">
    3.<action method="setProductsCount"><count>4</count></action>
    4.<action method="addPriceBlockType">
    5.<type>bundle</type>
    6.<block>bundle/catalog_product_price</block>
    7.<template>bundle/catalog/product/price.phtml</template>
    8.</action>
    9.<action method="setColumnCount"><count>4</count></action>
    10.</block>
    11.</reference>

    在第2行之前插入:

    <block type="catalog/navigation" name="cms_catalog" template="catalog/catalog.phtml"/>

    然后在 appdesignfrontend wddefault emplatecatalog 下新建 catalog.phtml 文件,其内容为以下代码:

    <?php $current_cat = $this->getCurrentCategory();?>
    <?php $current_cat = (is_object($current_cat) ? $current_cat->getName() : '');?><div class="catalog">
    <?php $collection = $this->getStoreCategories();?>
    <?php foreach ($collection as $_category):?>
       <?php if ($_category->getName() == $current_cat) {?>
        <a href="<?php echo $this->getCategoryUrl($_category)?>"><?php echo $_category->getName()?><br/>
       <?php }else{ ?>
        <h2><a href="<?php echo $this->getCategoryUrl($_category)?>"> <?php echo $_category->getName()?></a></h2>
       <?php }?>
         <?php foreach($_category->getChildren() as $_childCategory):?>
         <?php if ($_childCategory->getName() == $current_cat) {?>
          <a href="<?php echo $this->getCategoryUrl($_childCategory)?>"><?php echo $_childCategory->getName()?></a><br/>
         <?php }else{ ?>
          <h6><a href="<?php echo $this->getCategoryUrl($_childCategory)?>"><?php echo $_childCategory->getName()?></a></h6>
         <?php }?>
          <?php foreach($_childCategory->getChildren() as $_cchildCategory):?>
            <?php if ($_cchildCategory->getName() == $current_cat) {?>
            <a href="<?php echo $this->getCategoryUrl($_cchildCategory)?>"><?php echo $_cchildCategory->getName()?></a><br/>
            <?php }else{ ?>
            <h6 style="margin-left:10px;"><a href="<?php echo $this->getCategoryUrl($_cchildCategory)?>"><?php echo $_cchildCategory->getName()?></a></h6>
             <?php }?>
            <?php endforeach?>
        <?php endforeach?>
    <?php endforeach?>
    </div>

    这样前台就可以看到效果了。。

    可以看到整个菜单。如果只想看一级菜单的话:

    <?php $current_cat = $this->getCurrentCategory();?>
    <?php $current_cat = (is_object($current_cat) ? $current_cat->getName() : '');?>
    <div class="catalog">
    <?php $collection = $this->getStoreCategories();?>
    <ul id="tabs" class="tabs">
    <?php $i=0; foreach ($collection as $_category):?>
    <li onclick="tab(<?php echo $i;?>)"> <?php echo $_category->getName()?></li>
    <?php
    $i++;
    ?>
    <?php endforeach?>
    </ul>
    </div>

    然后可以做一个切换的tab。

     在app.js最后添加:

    function tab(x){
    var lis=document.getElementById("tabs").getElementsByTagName("li");
    for(var i=0;i<lis.length;i++){
    lis[i].className="";
    lis[x].className="liActive";
    document.getElementById('tabs-con'+i).style.display="none";
    document.getElementById('tabs-con'+x).style.display="block";
    }
    };

  • 相关阅读:
    WPF 柱状图显示数据
    WPF 寻找控件模板中的元素
    WPF 寻找数据模板中的元素
    WPF VisualTreeHelper的使用
    WPF依赖项属性不需要包装属性也可以工作
    WPF依赖属性对内存的使用方式
    WPF Binding Path妙用
    WPF Binding Path妙用代码实现
    WPF Binding妙处-既无Path也无Source
    WPF ListView的使用
  • 原文地址:https://www.cnblogs.com/bethel511/p/3779368.html
Copyright © 2020-2023  润新知