twPostMeta::count()

function count($key, $rec = null)
{
	global $con;
	
	$id = is_null($rec) ? $GLOBALS['news']->f('post_id') : $rec->f('post_id');
	$sql = 'SELECT COUNT(DISTINCT meta_id) AS count FROM ' . DB_PREFIX . 'post_meta WHERE post_id = ' . $id . ' AND meta_key = \'' . $key . '\'';
	$count = $con->select($sql);
	
	
	if ($count === false || $count->isEmpty())
		return false;
	
	$count->fetch();
	
	return (int) $count->f('count');
}

twTags::NbTags()

function NbTags($notag = 'aucun tag', $onetag = 'un tag', $severaltags = '%s tags') 
{       
	
	$count = twPostMeta::count('tag');
 
	if ($count === false)
		return false;
 
	switch($count)
	{       
		case 0: 
			echo $notag; 
		break;  		
 
		case 1: 
			echo $onetag;
		break;  
		
		default:
			printf($severaltags, $count);
		break;  
	}       
}

twTags::show()

function show($separator = ', ', $ifEmpty = 'Pas de tags pour ce post')
{
	$tags = twPostMeta::field('tag', TWPM_F_ALL);
	
	if (!$tags || count($tags) == 0)
	{
		echo $ifEmpty;
		return;
	}
	
	uasort ($tags, array('twTags','_strcmp'));
	
	$str = '';
	
	foreach ($tags as $tag)
		$str .= $separator . '<a href="' . twTags::_url($tag) . '" rel="tag">' . htmlspecialchars($tag) . '</a>';
 
	echo substr($str, strlen($separator));
}