當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。