亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

magento創建動態菜單 Create Dynamic CMS Navig

系統 1796 0

Introduction

As you know in Magento, catalog has dynamic menu but cms doesn’t in frontend.
If you are curios about how to create dynamic menu for CMS which can either be included in left or right sidebar for all CMS pages, then you are in right place.


Steps

1. Create navigation.phtml file
Create nagivation.phtml file in folder: app/design/frontend/[your-interface]/[your-theme]/template/cms/
and add the following code:

    <?php
$cmsPages = Mage::getModel('cms/page')->getCollection()
            ->addStoreFilter(Mage::app()->getStore()->getId())
            ->addFieldToFilter('is_active',1)
            ->addFieldToFilter('identifier', array(
                array(
                    'nin' => array(
                            'home',
                            'no-route',
                            'enable-cookies',
                            'empty'
                        )
                    )
                )
            );
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style type="text/css">
    #cms-navigation a.active { color: red; }?
</style>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function() {
    var url = window.location.pathname,
    urlRegExp = new RegExp(url.replace(/\/$/,'') + "$");
    jQuery('#cms-navigation a').each(function(){
        if(urlRegExp.test(this.href.replace(/\/$/,''))){
            jQuery(this).addClass('active');
        }
    });
 });
</script>
<div class="block">
    <div class="block-title">
        <strong><span>CMS Navigation</span></strong>
    </div>
    <div class="block-content">
        <ul id="cms-navigation" style="padding: 10px;">
            <?php
            foreach($cmsPages as $_cms):
                $page = $_cms->getData();
                ?>
                <li><a href="<?php echo $this->getBaseUrl() . $page['identifier']; ?>"><?php echo $page['title']; ?></a></li>
                <?php
            endforeach;
            ?>
 
        </ul>
    </div>
</div>
  
?

OR
You can simply download the navigation.phtml file from [here]

?

2> Include CMS Navigation in Layout
Copy/paste the following XML code in your layout XML file (preferably in your theme’s local.xml file):

    <cms_page_view>
    <reference name="left"><!--or right-->
        <block type="core/template" name="cms-navigation" template="cms/navigation.phtml" before="-" />
    </reference>
</cms_page_view>
  
?

This will automatically include the CMS navigation in layout file.


Notes:
Make sure you select the proper Layout template from CMS form ( Design > Page Layout > Layout ).
For example, in order to include CMS navigation in left column you either have to use: Layout = 2 columns with left bar or 3columns .

?

3> That’s all.

If you visit the CMS pages in frontend you will see navigation with all the CMS pages dynamically included with current one being highlighted (see below snapshot).


This will of course make your CMS pages look more beautiful and user friendlier.

magento創建動態菜單 Create Dynamic CMS Navigation For Magento Frontend

CMS Navigation

?

Happy E-commerce!

?

來源: http://www.blog.magepsycho.com/create-dynamic-cms-navigation-for-magento-frontend/

?

?

magento創建動態菜單 Create Dynamic CMS Navigation For Magento Frontend


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 精品久久久久久国产免费了 | 亚洲成年网站 | 国产短视频精品区第一页 | 久久香蕉国产精品一区二区三 | 亚洲视频高清 | 欧美一级毛片免费网站 | 特一级黄 | 亚洲综合在线播放 | 一区二区精品久久 | 三级天堂 | 九九线精品视频 | 色一情一乱一伦麻豆 | 亚洲综合爱爱久久网 | 日韩成人综合网 | 亚洲成在人 | 亚洲精品亚洲人成在线 | 久久精品中文字幕 | 在线看福利视频120秒 | 欧美成人精品在线 | 成人午夜亚洲影视在线观看 | 欧美国产中文 | 欧美特级特黄a大片免费 | 欧美一级特黄aaa大片 | 日本老太做爰xx | 四虎精品影院4hutv四虎 | 亚洲欧美国产毛片在线 | 色网站在线看 | 亚洲系列中文字幕一区二区 | 性欧美高清come | 成人在线免费视频 | 变态 调教 视频 国产九色 | 91视频亚洲 | 国产日韩欧美二区 | 免费国产一区 | 亚洲人体视频 | 国产做受视频激情播放 | 久久久久国产一级毛片高清板 | 亚洲欧美日韩久久精品第一区 | 99久久久精品免费观看国产 | 久久久免费观看视频 | 福利色姬网站视频入口 |