diff options
Diffstat (limited to 'core/controllers/welcome.php')
-rw-r--r-- | core/controllers/welcome.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 4f4f7535..a3e46214 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -47,8 +47,17 @@ class Welcome_Controller extends Template_Controller { try { $this->template->tag_count = ORM::factory("tag")->count_all(); + $this->template->most_tagged = Database::instance() + ->select("item_id AS id", "COUNT(tag_id) AS count") + ->from("items_tags") + ->groupby("item_id") + ->orderby("count", "DESC") + ->limit(1) + ->get() + ->current(); } catch (Exception $e) { $this->template->tag_count = 0; + $this->template->most_tagged = 0; } set_error_handler($old_handler); |