/** * Global tag cloud and search form * * @param string $area Site area * @global CotDB $db */ function cot_tag_search_form($area = 'all') { global $db, $dt, $perpage, $lang, $tl, $qs, $t, $L, $R, $cfg, $db_tag_references, $tc_styles; $limit = $perpage > 0 ? "{$dt}, {$perpage}" : NULL; $tcloud = cot_tag_cloud($area, $cfg['plugin']['tags']['order'], $limit); $tc_html = $R['tags_code_cloud_open']; foreach ($tcloud as $tag => $cnt) { $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag; $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag; $tl = $lang != 'en' && $tag_u != $tag ? 1 : null; foreach ($tc_styles as $key => $val) { if ($cnt <= $key) { $dim = $val; break; } } $tc_html .= cot_rc('tags_link_cloud_tag', array('url' => cot_url('plug', array('e' => 'tags', 'a' => $area, 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), 'tag_title' => htmlspecialchars($tag_t), 'dim' => $dim)); } $tc_html .= $R['tags_code_cloud_close']; $t->assign('TAGS_CLOUD_BODY', $tc_html); $t->parse('MAIN.TAGS_CLOUD'); if ($perpage > 0) { $where = $area == 'all' ? '' : "WHERE tag_area = '{$area}'"; $sql = $db->query("SELECT COUNT(DISTINCT `tag`) FROM {$db_tag_references} {$where}"); $totalitems = (int) $sql->fetchColumn(); $pagenav = cot_pagenav('plug', 'e=tags&a=' . $area, $dt, $totalitems, $perpage, 'dt'); $t->assign(array('TAGS_PAGEPREV' => $pagenav['prev'], 'TAGS_PAGENEXT' => $pagenav['next'], 'TAGS_PAGNAV' => $pagenav['main'])); } }
Hooks=index.tags Tags=index.tpl:{INDEX_TAG_CLOUD},{INDEX_TAG_CLOUD_ALL_LINK} [END_COT_EXT] ==================== */ /** * Tag clouds for index page * * @package Tags * @copyright (c) Cotonti Team * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt */ defined('COT_CODE') or die('Wrong URL'); if ($cfg['plugin']['tags']['pages'] || $cfg['plugin']['tags']['forums']) { require_once cot_incfile('tags', 'plug'); $limit = $cfg['plugin']['tags']['lim_index'] == 0 ? null : (int) $cfg['plugin']['tags']['lim_index']; $tcloud = cot_tag_cloud($cfg['plugin']['tags']['index'], $cfg['plugin']['tags']['order'], $limit); $tc_html = $R['tags_code_cloud_open']; $tag_count = 0; foreach ($tcloud as $tag => $cnt) { $tag_count++; $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag; $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag; $tl = $lang != 'en' && $tag_u != $tag ? 1 : null; foreach ($tc_styles as $key => $val) { if ($cnt <= $key) { $dim = $val; break; } } $tc_html .= cot_rc('tags_link_cloud_tag', array('url' => cot_url('plug', array('e' => 'tags', 'a' => $cfg['plugin']['tags']['index'], 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), 'tag_title' => htmlspecialchars($tag_t), 'dim' => $dim)); }
Tags=forums.sections.tpl:{FORUMS_SECTIONS_TAG_CLOUD},{FORUMS_SECTIONS_TAG_CLOUD_ALL_LINK} [END_COT_EXT] ==================== */ /** * Forum tag cloud * * @package Tags * @copyright (c) Cotonti Team * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt */ defined('COT_CODE') or die('Wrong URL'); if ($cfg['plugin']['tags']['forums']) { require_once cot_incfile('tags', 'plug'); // Get all subcategories $limit = $cfg['plugin']['tags']['lim_forums'] == 0 ? null : (int) $cfg['plugin']['tags']['lim_forums']; $tcloud = cot_tag_cloud('forums', $cfg['plugin']['tags']['order'], $limit); $tc_html = $R['tags_code_cloud_open']; $tag_count = 0; foreach ($tcloud as $tag => $cnt) { $tag_count++; $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag; $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag; $tl = $lang != 'en' && $tag_u != $tag ? 1 : null; foreach ($tc_styles as $key => $val) { if ($cnt <= $key) { $dim = $val; break; } } $tc_html .= cot_rc('tags_link_cloud_tag', array('url' => cot_url('plug', array('e' => 'tags', 'a' => 'forums', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), 'tag_title' => htmlspecialchars($tag_t), 'dim' => $dim)); }