Closed (fixed)
Project:
Article
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
3 Sep 2005 at 22:36 UTC
Updated:
26 Sep 2007 at 21:26 UTC
The subject pretty much says it. For example, I might want "pages" but not "stories" to be listed as "articles" in the most recent articles and on the articles index pages. It woudl be great to have a check list of content types in the admin section and then be able to check off content types to include or exclude.
It's probably better to exclude. That way if the variable is empty, there are no exclusions instead of no inclusions and it's consistent - add one, that's one exclusion.
Comments
Comment #1
Cygon commentedI second that. The article module should definitely have an option for showing only a subset of the available node types.
For exampl,e in a typical case, the "page" node type is used for the static site content, the "story" node type for articles and maybe (using the weblink or janode module) a "link" node to create a directory of useful links.
Now you wouldn't want to show the static site structure when the user is browsing for articles. Neither would you want to show all the site's articles in your link directory.
Comment #2
Cygon commentedI helped myself with a little modification:
1) Adjust the node counts displayed on the taxonomy tree
Replace
$cur->count = module_invoke('taxonomy', 'term_count_nodes', ($cur->tid));
by
$cur->count = module_invoke('taxonomy', 'term_count_nodes', ($cur->tid), ('story'));
2) Modify the select_nodes function:
Replace
function articles_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE, $count = 0) {
by
function articles_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE, $count = 0, $type = 0) {
3) Inside that function, replace
$sql = 'SELECT DISTINCT n.nid, n.title, n.sticky, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC';
$sql_count = 'SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1';
by
if(is_numeric($type)) {
$sql = 'SELECT DISTINCT n.nid, n.title, n.sticky, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC';
$sql_count = 'SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1';
} else {
$sql = 'SELECT DISTINCT n.nid, n.title, n.sticky, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 AND n.type = \'' . $type . '\' ORDER BY n.sticky DESC, n.created DESC';
$sql_count = 'SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 AND n.type = \'' . $type . '\'';
}
4) Still in this function, replace
$wheres .= ' AND tn'. $index .'.tid IN ('. implode(',', $tids) .')';
by
if(is_numeric($type))
$wheres .= ' AND tn'. $index .'.tid IN ('. implode(',', $tids) .')';
else
$wheres .= ' n.type = \'$type\' AND tn'. $index .'.tid IN ('. implode(',', $tids) .')';
5) Finally, in articles_page(), replace
print theme('page', $body . module_invoke('taxonomy', 'render_nodes', module_invoke('taxonomy', 'select_nodes', $terms)));
by
print theme('page', $body . module_invoke('taxonomy', 'render_nodes', articles_select_nodes($terms, 'or', 0, TRUE, 0, 'article')));
Comment #3
msameer commentedComment #4
msameer commentedClosing this. Please reopen if still relevant.