当前位置: 首页>>代码示例>>PHP>>正文


PHP Model_Category::getWidgets方法代码示例

本文整理汇总了PHP中Model_Category::getWidgets方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Category::getWidgets方法的具体用法?PHP Model_Category::getWidgets怎么用?PHP Model_Category::getWidgets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_Category的用法示例。


在下文中一共展示了Model_Category::getWidgets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_index

 public function action_index()
 {
     $this->template->page_title = 'Главная страница';
     //$this->template->block_center = array($block_center);
     $category = new Model_Category('tree');
     $categoryName = $this->request->param('category');
     $categoryId = $category->getCategoryIdByUrl('glavnaya');
     //ВИДЖЕТЫ ДЛЯ ГЛАВНОЙ СТРАНИЦЫ
     $widgets = $category->getWidgets($categoryId);
     $this->styles = array();
     $wdgtarr = array();
     //        if($this->template->block_center!=NULL)
     //            {
     //                $oldWidgets = $this->template->block_center;
     //                foreach ($oldWidgets as $oldWidget)
     //                    array_push($wdgtarr['block_center'], $oldWidget);
     //            }
     $widgets = $this->getWidgets($categoryId);
     if (is_array($widgets)) {
         foreach ($widgets as $position => $widget) {
             $this->template->{$position} = $widget;
         }
     }
     $old_styles = $this->template->styles;
     array_unique($this->styles);
     $new_styles = array_merge($this->styles, $old_styles);
     $this->template->styles = $new_styles;
 }
开发者ID:chernogolov,项目名称:blank,代码行数:28,代码来源:Index_OLD.php

示例2: getWidgets

 public function getWidgets($categoryId, $page = '')
 {
     $category = new Model_Category('tree');
     $widgets = $category->getWidgets($categoryId);
     $wdgtarr = array();
     $positions = $category->getWidgetPositions();
     foreach ($positions as $position) {
         if ($this->template->{$position}['position'] != NULL) {
             $oldWidgets = $this->template->{$position}['position'];
             foreach ($oldWidgets as $oldWidget) {
                 $wdgtarr[$position['position']][] = $oldWidget;
             }
         }
     }
     foreach ($widgets as $widget) {
         //Виджеты
         if ($widget['name'] == 'catalog' || $widget['name'] == 'catalog2') {
             $page1 = $page;
         } else {
             $page1 = '';
         }
         if (is_file('css/' . $widget['name'] . '.less')) {
             array_push($this->styles, 'css/' . $widget['name'] . '.less');
         }
         if (is_file('js/' . $widget['name'] . '.js')) {
             array_push($this->template->scripts, 'js/' . $widget['name'] . '.js');
         }
         $action = Arr::get($widget, 'action', 'index');
         $widget_url = 'widgets/' . $widget['name'] . '/' . $action . '/' . $widget['wid'] . $page1;
         $wdgt = Request::factory($widget_url)->execute();
         if (!isset($wdgtarr[$widget['position']])) {
             $wdgtarr[$widget['position']] = array($wdgt);
         } else {
             array_push($wdgtarr[$widget['position']], $wdgt);
         }
     }
     return $wdgtarr;
     //Вывод в шаблон
 }
开发者ID:chernogolov,项目名称:blank,代码行数:39,代码来源:Main.php


注:本文中的Model_Category::getWidgets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。