當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Topic::count方法代碼示例

本文整理匯總了PHP中Topic::count方法的典型用法代碼示例。如果您正苦於以下問題:PHP Topic::count方法的具體用法?PHP Topic::count怎麽用?PHP Topic::count使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Topic的用法示例。


在下文中一共展示了Topic::count方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: forum

 /**
  * Список тем
  */
 public function forum($id)
 {
     if (!($forum = Forum::find_by_id($id))) {
         App::abort('default', 'Данного раздела не существует!');
     }
     $total = Topic::count(['conditions' => ['forum_id = ?', $id]]);
     $page = App::paginate(Setting::get('topics_per_page'), $total);
     $topics = Topic::all(['conditions' => ['forum_id = ?', $id], 'offset' => $page['offset'], 'limit' => $page['limit'], 'order' => 'updated_at desc', 'include' => ['forum', 'post_count', 'post_last' => ['user']]]);
     /*		$topics = Topic::all([
     			'select' => 't.*, p.user_id post_user, p.created_at post_created',
     			'from' => 'topics as t',
     			'conditions' => ['t.forum_id = ?', $id],
     			'joins' => ['LEFT JOIN (
     					SELECT topic_id, MAX(created_at) AS max FROM posts
     					GROUP BY topic_id
     				) AS latest ON t.id = latest.topic_id
     				LEFT JOIN posts p ON p.created_at = latest.max
     				AND p.topic_id = latest.topic_id'],
     			'offset' => $page['offset'],
     			'limit' => $page['limit'],
     			'order' => 't.updated_at desc',
     			'include' => [
     				'forum',
     				'post_count',
     			],*/
     $crumbs = ['/forum' => 'Форум', $forum->title];
     if ($forum->parent_id) {
         $crumbs = ['/forum' => 'Форум', '/forum/' . $forum->parent_id => $forum->parent()->title, $forum->title];
     }
     App::view('forums.forum', compact('forum', 'topics', 'page', 'crumbs'));
 }
開發者ID:visavi,項目名稱:rotorcms,代碼行數:34,代碼來源:ForumController.php

示例2: forumCount

/**
 *  Количество сообщений в форума
 * @return integer сообщений в форуме
 */
function forumCount()
{
    return Topic::count() . '/' . Post::count();
}
開發者ID:visavi,項目名稱:rotorcms,代碼行數:8,代碼來源:helpers.php

示例3: onUnSubscribe

 /**
  * A request to unsubscribe from a topic has been made.
  *
  * @param \Ratchet\ConnectionInterface $conn
  * @param string|Topic                 $topic The topic to unsubscribe from
  */
 public function onUnSubscribe(ConnectionInterface $conn, $topic)
 {
     $this->console->info("onUnSubscribe: topic: {$topic} {$topic->count()}");
 }
開發者ID:askedio,項目名稱:laravel-ratchet,代碼行數:10,代碼來源:Pusher.php


注:本文中的Topic::count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。