function nm_tag_list() { global $NMPAGEURL; if ($NMPAGEURL == '') { return; } $tags = array(); foreach (nm_get_tags() as $tag => $posts) { if (substr($tag, 0, 1) != '_') { $tags[$tag] = count($posts); } } if (!empty($tags)) { echo '<ul class="nm_tag_list">', PHP_EOL; foreach ($tags as $tag => $count) { $url = nm_get_url('tag') . rawurlencode($tag); echo ' <li><a href="', $url, '">', htmlspecialchars($tag), '</a></li>', PHP_EOL; } echo '</ul>', PHP_EOL; } }
function nm_show_tag_page($tag, $index = NMFIRSTPAGE, $filter = true) { global $NMPOSTSPERPAGE; $tag = nm_lowercase_tags($tag); $tags = nm_get_tags(); if (array_key_exists($tag, $tags)) { $showexcerpt = nm_get_option('excerpt'); $posts = $tags[$tag]; $p1 = intval(NMFIRSTPAGE); $index = intval($index); $pages = array_chunk($posts, intval($NMPOSTSPERPAGE), true); if ($index >= $p1 && $index - $p1 < sizeof($pages)) { $posts = $pages[$index - $p1]; if ($filter) { ob_start(); } foreach ($posts as $slug) { nm_show_post($slug, $showexcerpt, false); } if (sizeof($pages) > 1 && nm_get_option('shownav', true)) { nm_show_navigation($index, sizeof($pages), $tag); } if ($filter) { echo nm_ob_get_content(true); } return true; } } return false; }