categories widget can now show numbers: EXPERIMENTAL, it's just a show-off :p needs some caching system
This commit is contained in:
parent
29a9e6bbd1
commit
bf13a21d35
@ -44,7 +44,7 @@ function smarty_function_list_categories($params) //, &$smarty)
|
|||||||
|
|
||||||
function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
|
function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
|
||||||
|
|
||||||
global $_FP_SMARTY;
|
global $smarty, $fpdb;
|
||||||
|
|
||||||
extract($params);
|
extract($params);
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
|
|||||||
array_push($result, $ild);
|
array_push($result, $ild);
|
||||||
|
|
||||||
|
|
||||||
$cat_entry = $_FP_SMARTY->get_template_vars('categories');
|
$cat_entry = $smarty->get_template_vars('categories');
|
||||||
if (!$cat_entry) $cat_entry = array();
|
if (!$cat_entry) $cat_entry = array();
|
||||||
//list($catId) = each($categories);
|
//list($catId) = each($categories);
|
||||||
|
|
||||||
@ -121,6 +121,11 @@ function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
|
|||||||
$after = $string;
|
$after = $string;
|
||||||
}elseif(isset($params['type']) && $params['type']=='linked'){
|
}elseif(isset($params['type']) && $params['type']=='linked'){
|
||||||
$after='</a>';
|
$after='</a>';
|
||||||
|
if (isset($params['count']) && $params['count']) {
|
||||||
|
$index =& $fpdb->get_index($vid);
|
||||||
|
$count = ($index)? $index->length() : 0;
|
||||||
|
$after = " ($count) ". $after;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($result, $after);
|
array_push($result, $after);
|
||||||
|
@ -13,6 +13,15 @@ Author URI: http://www.nowhereland.it/
|
|||||||
function plugin_categories_widget() {
|
function plugin_categories_widget() {
|
||||||
|
|
||||||
global $smarty;
|
global $smarty;
|
||||||
|
|
||||||
|
// set this to true if you want show the number
|
||||||
|
// of categories for each category; please notice:
|
||||||
|
// not cheap on the server, it should be cached
|
||||||
|
// somewhere else
|
||||||
|
|
||||||
|
// default: disabled
|
||||||
|
|
||||||
|
$smarty->assign('categories_showcount', false);
|
||||||
|
|
||||||
// load plugin strings
|
// load plugin strings
|
||||||
// they're located under plugin.PLUGINNAME/lang/LANGID/
|
// they're located under plugin.PLUGINNAME/lang/LANGID/
|
||||||
|
@ -1 +1 @@
|
|||||||
{list_categories type=linked}
|
{list_categories type=linked count=$categories_showcount}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user