示例#1
0
$tag = new CTag();
$tag->canDo();
$order = "name";
$where = array();
$where["object_class"] = " = '{$object_class}'";
if ($is_child) {
    $where["parent_id"] = " IS NOT NULL";
    $order = "parent_id, name";
}
if ($parent_id) {
    $where["parent_id"] = " = '{$parent_id}'";
}
if ($tag_name) {
    $where["name"] = " LIKE '%{$tag_name}%'";
}
/** @var CTag[] $tags */
$total = $tag->countList($where);
$tags = $tag->loadList($where, $order, "{$page}, {$limit}");
foreach ($tags as $key => $_tag) {
    $_tag->countRefItems();
    $_tag->loadRefParent();
}
// smarty
$smarty = new CSmartyDP();
$smarty->assign("tags", $tags);
$smarty->assign("tag", $tag);
$smarty->assign("tag_parent", $tag_parent);
$smarty->assign("page", $page);
$smarty->assign("limit", $limit);
$smarty->assign("total", $total);
$smarty->display("inc_list_tags.tpl");