| Профиль | Блог (52) | Комментарии (794) | Закладки (7) | Продукты (7) |
Пытаюсь разобраться, почему по ссылке: cogear.ru/community/ мы видим панель навигации:
А по ссылке: cogear.ru/community/all/ она отсутствует?
А по ссылке: cogear.ru/community/all/ она отсутствует?


Смотри роуты в конфиге и методы в контроллере.
routes[] = "% = community" routes[] = "news = community/news" routes[] = "video = community/video"Но они здесь для того, что бы были у нас были ссылки вида: cogear.ru/news и cogear.ru/video.
Дима, а не подскажешь в какой шестеренке смотреть?
$url_name = 'all'смотри контролер index.php и метод index() в модуле.в нем идет другая обработка если $url_name = 'all'.
Но там, в функции
function index($url_name = FALSE, $action = FALSE, $subaction = FALSE)действительно обрабатывается иначе, но не по отношении, если наш урл cogear.ru/community/ а по отношению, если наши урлы cogear.ru/community/news/, cogear.ru/community/video/ и т. д…Скажите, пожалуйста, а какой код добавить в эту функцию, что бы появилась панель при урлах community/news/, community/video/, community/all/ и т. д.
function index($url_name = FALSE, $action = FALSE, $subaction = FALSE){ if($url_name == 'all') { $this->builder->h1(t('!gears community').(acl('community create') ? ' '.$this->builder->a($this->builder->img('/gears/community/img/icon/star.png',FALSE,FALSE,t('!edit create')),l('/community/create/')) : FALSE),TRUE); $this->community->query(); $config['per_page'] = $this->gears->community->per_page_list; $page = $this->pager((int)$action, $this->db->count_all_results('community',FALSE),$config); $this->db->limit($page['limit'],$page['start']); $all = $this->db->get('community')->result_array(); if(!$all) info(); else { foreach($all as &$community){ if($community['icon']) { $community['icon'] = make_icons($community['icon']); $community['icon'] = $community['icon']['24x24']; } $community['class'] = 'avatar'; } $header = array( 'icon'=>array('','image','5%','class'=>'avatar'), 'name'=>array(fc_t('community'),'link','30%',FALSE,'left','before'=>'<h1>','after'=>'</h1>'), 'aname'=>array(fc_t('admin'),'link','10%','before'=>'<span class="user">','after'=>'</span>'), 'users_num'=>array(fc_t('members'),'text','20%','before'=>'<h1>','after'=>'</h1>'), 'nodes_num'=>array(fc_t('!gears nodes'),'text','20%','before'=>'<h1>','after'=>'</h1>') ); $info = array( 'link'=>array('/community','/user'), 'link_add'=>array('url_name','aurl_name'), 'noname'=>'true', ); $this->form->grid('communities',$header,$all,$info)->compile(); } } elseif($url_name && !is_numeric($url_name)){ $this->community->show($url_name,$action,$subaction); } else { $this->db->where('nodes.cid != 0'); $this->nodes->get((int)$url_name,FALSE,TRUE); } }Вопросы:
routes[] = "community/? = index/0/community"следовательно, в этом случае вызывается метод index модуля index. так что посмотри код в нем, там есть код, где строится интересующая тебя панель.
$this->panel->set('index',FALSE,TRUE,'!global tabs')->base('/')->data($filter) ...Вот код отвечающий за построение панели из файла index/index.php
$this->panel->set('index',FALSE,TRUE,'!global tabs')->base('/')->data($filter) ->add(array('name'=>'best','text'=>fc_t('index best').' ('.$counter['best'].')'.($counter['best_new'] > 0 ? ' <sup>+'.$counter['best_new'] .'</sup>' : ''),'index'=>TRUE,'title'=>FALSE)); if($this->gears->community) $this->panel->add(array('name'=>'community','text'=>t('!gears community').' ('.$counter['community'].')'.($counter['community_new'] > 0 ? ' <sup>+'.$counter['community_new'] .'</sup>' : ''),'title'=>t('!gears community'))) ->add(array('name'=>'blogs','text'=>t('!gears blogs').' ('.$counter['blogs'].')'.($counter['blogs_new'] > 0 ? ' <sup>+'.$counter['blogs_new'] .'</sup>' : ''),'title'=>t('!gears blogs'))) ->add(array('name'=>'new','text'=>t('index new').' ('.$counter['new'].')'.($counter['new_new'] > 0 ? ' <sup>+'.$counter['new_new'] .'</sup>' : ''),'title'=>t('index new'))) ->set_active($filter ? $filter : 'best') ->compile(2);Хорошо поизучав код — понял, что урл типа cogear.ru/community/ выводится шестеренкой index, а урлы cogear.ru/community/что-либо выводятся шестеренкой community и если я хочу видеть панель когда работает шестеренка community, то я должен в функцию в файле community/index.php дописать модифицированный код панели.
function index($url_name = FALSE, $action = FALSE, $subaction = FALSE){ ... else { $this->db->where('nodes.cid != 0'); $this->nodes->get((int)$url_name,FALSE,TRUE); } // Дописать модифицированный код панели. }Лично у меня нет, хотя сделал все, как написано в этом посте.