Exemplo n.º 1
0
function list_assigned_categories($id)
{
    global $ft, $rewrite;
    $query = sprintf("\r\n        SELECT \r\n            a.*, b.* \r\n        FROM \r\n            %1\$s a \r\n        LEFT JOIN \r\n            %2\$s b \r\n        ON \r\n            a.category_id = b.category_id \r\n        WHERE \r\n            a.news_id = '%3\$d'", TABLE_ASSIGN2CAT, TABLE_CATEGORY, $id);
    $sql = new DB_SQL();
    $sql->query($query);
    $count_cats = $sql->nf();
    $idx = 1;
    while ($sql->next_record()) {
        $cname = replace_amp($sql->f('category_name'));
        $cid = $sql->f('category_id');
        $category_link = (bool) $rewrite ? sprintf('1,%s,4,item.html', $cid) : 'index.php?p=4&id=' . $cid;
        $ft->assign(array('CATEGORY_NAME' => $cname, 'CATEGORY_LINK' => $category_link, 'COMMA' => $count_cats == $idx ? '' : ', '));
        $ft->parse('CAT_ROW', ".cat_row");
        $idx++;
    }
    // CAT_ROW musi byc czyste
    $ft->clear_parse('CAT_ROW');
}
Exemplo n.º 2
0
function list_assigned_categories($id)
{
    global $ft, $rewrite, $CoreRewrite;
    $query = sprintf("\n        SELECT \n            a.*, b.* \n        FROM \n            %1\$s a \n        LEFT JOIN \n            %2\$s b \n        ON \n            a.category_id = b.category_id \n        WHERE \n            a.news_id = '%3\$d'", TABLE_ASSIGN2CAT, TABLE_CATEGORY, $id);
    $sql = new DB_SQL();
    $sql->query($query);
    $count_cats = $sql->nf();
    $idx = 1;
    while ($sql->next_record()) {
        $cname = replace_amp($sql->f('category_name'));
        $cid = $sql->f('category_id');
        $ft->assign(array('CATEGORY_NAME' => $cname, 'CATEGORY_LINK' => $CoreRewrite->category_news($cid, $rewrite), 'COMMA' => $count_cats == $idx ? '' : ', '));
        $ft->parse('CAT_ROW', ".cat_row");
        $idx++;
    }
    // CAT_ROW musi byc czyste
    $ft->clear_parse('CAT_ROW');
}