public function tagged($tag = '') { $tag or redirect('blog'); // Count total blog posts and work out how many pages exist $pagination = create_pagination('blog/tagged/' . $tag, $this->blog_m->count_tagged_by($tag, array('status' => 'live')), NULL, 4); // Get the current page of blog posts $blog = $this->blog_m->limit($pagination['limit'])->get_tagged_by($tag, array('status' => 'live')); foreach ($blog as &$post) { $post->keywords = Keywords::get_links($post->keywords, 'blog/tagged'); } // Set meta description based on post titles $meta = $this->_posts_metadata($blog); $name = str_replace('-', ' ', $tag); // Build the page $this->template->title($this->module_details['name'], lang('blog_tagged_label') . ': ' . $name)->set_metadata('description', lang('blog_tagged_label') . ': ' . $name . '. ' . $meta['description'])->set_metadata('keywords', $name)->set_breadcrumb(lang('blog_blog_title'), 'blog')->set_breadcrumb(lang('blog_tagged_label') . ': ' . $name)->set('blog', $blog)->set('tag', $tag)->set('pagination', $pagination)->build('tagged', $this->data); }