ecmall 挂件显示方法

来源:互联网 发布:windows10共享设置软件 编辑:程序博客网 时间:2024/04/30 00:20

ecmall 挂件显示方法

Ecmall 的挂件是怎么显示的常常让人很费解:明明看到源码中首页调用的index.html中什么内容也没有,但前台就是一堆的挂件就显示出来了,究竟是什么回事呢,让我们来揭开ecmall挂件在首页中显示的神秘面纱。

1.挂件widgets    在目录data  的page_config 目录的中 比如首页生成的挂件是default.index.config.php

2.  挂件语句解析:  

return array (

  'widgets' =>      

  array (

    '_widget_513' =>                      //挂件名称

    array (

      'name' => 'best_goods',              //挂件类型  (精品推荐)

      'options' => NULL,

    ),

  ),

  'config' =>

  array (

    'top_left' =>                            

        $controller =& cc();

        $controller->display_widgets($arr);

    }

 frontend.base.php 文件中 函数:

 display_widgets($options)

 中 调用  

   

        $widgets = get_widget_config($this->_get_template_name(), $page);

 

d) wedget.base.php 文件中的函数:

     get_widget_config

   调用 default.index.config.php 文件;

    $config_file = ROOT_PATH . '/data/page_config/' . $template_name . '.' . $page . '.config.php';

     这里 $template_name 值为default

          $page值为index所以生成default.index.config.php文件。

 

e)挂件解析会解析两步:

   1. 首先将 <!--{widgets page=index area=top_left}--> 解析为:

           <?php $this->display_widgets(array('page'=>'index','area'=>'top_left')); ?>

   2. 读取以上挂件数组中数据生成网页可识别的标准数据:

          

    <div id="_widget_513" name="best_goods" widget_type="widget" class="widget">

         <div class="module_common">

            <h2><b class="best_item" title="BEST ITEM精品推荐"></b></h2>

            <div class="wrap">

               <div class="wrap_child">

                 <div class="recommend">

                     <ul class="list_pic"> </ul>

                 </div>

              </div>

            </div>

        </div>

    </div>

 

 

 

 

 

首页布局样式图:

 

|---content--------------------right---------------------------------

|                       |                                |                                 |

|                       |                            |                                |

top_left                cycle_image     |     sales                    |

|                       |-------------------------------------------------|

|                       |                                                          |

|                       |        top_right                                        |

|----------------|-------------------------------------------------|                                                                  |

|       banner                                                             |

|----------content-------------------------------------------------|

|                   |                                                       |

|    bottom_left  |    bottom_right                                 |

|------------------------------------------------------------------|

|                                                                           |

|    bottom_down                                                          |

|------------------------------------------------------------------|

原创粉丝点击