public function tag_list() { $tagcount = 0; $sql = "SELECT t.term AS slug, t.term_display AS text, count(tp.object_id) as ttl FROM {terms} t INNER JOIN {object_terms} tp ON t.id=tp.term_id INNER JOIN {posts} p ON p.id=tp.object_id AND p.status = ? WHERE t.vocabulary_id = ? AND tp.object_type_id = ? GROUP BY t.term ORDER BY t.term_display"; foreach( DB::get_results( $sql, array(Post::status('published'), Tags::vocabulary()->id, Vocabulary::object_type_id( 'post' ) ) ) as $index=> $tag) { if ( $tagcount++ != 0 ) { echo ", "; } echo "