From 082730f29a92f291581ef82adecef346438c6ca7 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 25 Dec 2011 22:34:20 +0000 Subject: [PATCH] get the tag initials from the database itself --- ext/tag_list/main.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index b3a13f4b6..dcdf3b2c0 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -132,13 +132,29 @@ private function get_starts_with() { } private function build_az() { - $alpha = "abcdefghijklmnopqrstuvwxyz"; + global $database; + + $tags_min = $this->get_tags_min(); + + $cache_key = "data/tag_inits-" . md5("tc" . $tags_min) . ".html"; + if(file_exists($cache_key)) {return file_get_contents($cache_key);} + + $tag_data = $database->get_col(" + SELECT DISTINCT + substr(tag, 1, 1) + FROM tags + WHERE count >= :tags_min + ORDER BY tag + ", array("tags_min"=>$tags_min)); + $html = ""; - for($n=0; $n$a))."'>$a"; } $html .= "


"; + + if(SPEED_HAX) {file_put_contents($cache_key, $html);} + return $html; } // }}}