plugins/CategoryList.php
changeset 5 b9e0209fff68
parent 4 d5b2e522396d
equal deleted inserted replaced
4:d5b2e522396d 5:b9e0209fff68
    63     
    63     
    64     $q = $db->sql_query('SELECT c.page_id, c.namespace, p.name, ( c.namespace = \'Category\' ) AS is_subcategory FROM ' . table_prefix . "categories AS c\n"
    64     $q = $db->sql_query('SELECT c.page_id, c.namespace, p.name, ( c.namespace = \'Category\' ) AS is_subcategory FROM ' . table_prefix . "categories AS c\n"
    65                       . "  LEFT JOIN " . table_prefix . "pages AS p\n"
    65                       . "  LEFT JOIN " . table_prefix . "pages AS p\n"
    66                       . "    ON ( p.urlname = c.page_id AND p.namespace = c.namespace )\n"
    66                       . "    ON ( p.urlname = c.page_id AND p.namespace = c.namespace )\n"
    67                       . "  WHERE c.category_id = '$cat_id'\n"
    67                       . "  WHERE c.category_id = '$cat_id'\n"
    68                       . "  ORDER BY is_subcategory DESC;");
    68                       . "  ORDER BY is_subcategory DESC, p.name ASC;");
    69   }
    69   }
    70   else
    70   else
    71   {
    71   {
    72     // nice little where clause...
    72     // nice little where clause...
    73     if ( $do_subs && !$do_pages )
    73     if ( $do_subs && !$do_pages )
    85     }
    85     }
    86     $q = $db->sql_query('SELECT c.page_id, c.namespace, p.name, ( c.namespace = \'Category\' ) AS is_subcategory FROM ' . table_prefix . "categories AS c\n"
    86     $q = $db->sql_query('SELECT c.page_id, c.namespace, p.name, ( c.namespace = \'Category\' ) AS is_subcategory FROM ' . table_prefix . "categories AS c\n"
    87                       . "  LEFT JOIN " . table_prefix . "pages AS p\n"
    87                       . "  LEFT JOIN " . table_prefix . "pages AS p\n"
    88                       . "    ON ( p.urlname = c.page_id AND p.namespace = c.namespace )\n"
    88                       . "    ON ( p.urlname = c.page_id AND p.namespace = c.namespace )\n"
    89                       . "  WHERE c.category_id = '$cat_id' AND $where\n"
    89                       . "  WHERE c.category_id = '$cat_id' AND $where\n"
    90                       . "  ORDER BY is_subcategory DESC;");
    90                       . "  ORDER BY is_subcategory DESC, p.name ASC;");
    91   }
    91   }
    92   if ( !$q )
    92   if ( !$q )
    93     $db->_die();
    93     $db->_die();
    94   
    94   
    95   $html = '';
    95   $html = '';