forum optimized
This commit is contained in:
parent
0d11490042
commit
cd297a27cd
|
@ -283,6 +283,7 @@ class Index extends Zira\Controller {
|
|||
if ($page>$pages) $page = $pages;
|
||||
if ($page<1) $page = 1;
|
||||
|
||||
/*
|
||||
$topics = Forum\Models\Topic::getCollection()
|
||||
->open_query()
|
||||
->select(Forum\Models\Topic::getFields())
|
||||
|
@ -311,6 +312,22 @@ class Index extends Zira\Controller {
|
|||
->order_by('id','desc')
|
||||
->limit($limit, ($page-1)*$limit)
|
||||
->get();
|
||||
*/
|
||||
|
||||
$topics = Forum\Models\Topic::getCollection()
|
||||
->select(Forum\Models\Topic::getFields())
|
||||
->left_join(Zira\Models\User::getClass(), array('user_firstname'=>'firstname', 'user_secondname'=>'secondname', 'user_username'=>'username'))
|
||||
->open_where()
|
||||
->where('language', 'is', null)
|
||||
->or_where('language', '=', Zira\Locale::getLanguage())
|
||||
->close_where()
|
||||
->and_where('category_id','=',$forum->category_id)
|
||||
->and_where('forum_id','=',$forum->id)
|
||||
->and_where('sticky','=',0)
|
||||
->and_where('published','=',Forum\Models\Topic::STATUS_PUBLISHED)
|
||||
->order_by('id','desc')
|
||||
->limit($limit, ($page-1)*$limit)
|
||||
->get();
|
||||
|
||||
$title = Zira\Locale::t($forum->title);
|
||||
$meta_title = $forum->meta_title ? Zira\Locale::t($forum->meta_title) : $title;
|
||||
|
|
Loading…
Reference in a new issue