From ebe226584bbc73d5705ecd2cd9b8c64b07e8df7e Mon Sep 17 00:00:00 2001 From: shish Date: Sat, 6 Sep 2008 20:46:05 +0000 Subject: [PATCH] category organisation git-svn-id: file:///home/shish/svn/shimmie2/trunk@1029 7f39781d-f577-437e-ae19-be835c7a54ca --- ext/tag_list/main.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 4f7b3cd4..156af4fd 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -33,6 +33,10 @@ class TagList implements Extension { $this->theme->set_heading("Tag List by Popularity"); $this->theme->set_tag_list($this->build_tag_popularity()); break; + case 'categories': + $this->theme->set_heading("Popular Categories"); + $this->theme->set_tag_list($this->build_tag_categories()); + break; } $this->theme->display_page($page); } @@ -90,7 +94,8 @@ class TagList implements Extension { $h_map = "Map"; $h_alphabetic = "Alphabetic"; $h_popularity = "Popularity"; - return "$h_index
$h_map
$h_alphabetic
$h_popularity"; + $h_cats = "Categories"; + return "$h_index
$h_map
$h_alphabetic
$h_popularity
$h_cats"; } private function build_tag_map() { @@ -170,6 +175,31 @@ class TagList implements Extension { return $html; } + + private function build_tag_categories() { + global $database; + global $config; + + $tags_min = $config->get_int('tags_min'); + $result = $database->execute("SELECT tag,count FROM tags ORDER BY count DESC, tag ASC LIMIT 9"); + $tag_data = $result->GetArray(); + + $html = ""; + $n = 0; + foreach($tag_data as $row) { + if($n%3==0) $html .= ""; + $h_tag = html_escape($row['tag']); + $link = $this->tag_link($row['tag']); + $image = $database->get_random_image(array($row['tag'])); + $thumb = $image->get_thumb_link(); + $html .= "\n"; + if($n%3==2) $html .= ""; + $n++; + } + $html .= "

$h_tag
"; + + return $html; + } // }}} // blocks {{{ private function add_related_block($page, $image) {