Closed (fixed)
Project:
IndexPage
Version:
5.x-1.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
7 Nov 2008 at 19:18 UTC
Updated:
9 Dec 2008 at 13:42 UTC
I mod the code to make the terms do a list but would really like a table with term name and term discription not sure if that is do able....
// Index by taxonomy terms block.
$voc_list = array();
$first = TRUE;
$suppress_unused = variable_get('indexpage_suppress_unused', FALSE);
if (variable_get('indexpage_'. $type .'_vocfilter', 1)) {
$vocs = db_query("SELECT v.name, v.vid FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} t ON t.vid=v.vid WHERE t.type='%s'", $type);
while ($voc = db_fetch_array($vocs)) {
if ($first) {
$first = FALSE;
//don't need net 2 lines
//$output .= '<h3>'. t('Category Index') .'</h3>';
//$output .= '<p><em>'. t('Terms that have content will link to a list of titles tagged with that term.') .'</em></p>';
}
$term_list = array();
$voc_list[$voc['vid']] = $voc['name'];
$output .= '<div class="indexpage-filter-'. $voc['vid'] .'">';
$voc_count = 0;
$terms = db_query('SELECT name, tid FROM {term_data} WHERE vid=%d ORDER BY weight, name', $voc['vid']);
while ($term = db_fetch_object($terms)) {
$sql = _indexpage_check_status("SELECT COUNT(n.nid) FROM {node} n LEFT JOIN {term_node} t on n.nid=t.nid WHERE type='%s' AND t.tid=%d");
$how_many = db_result(db_query($sql, $type, $term->tid));
if ($how_many) {
$term_list[] = l($term->name, "indexpage/$type/$term->tid") . ($show_count ? ' ('. $how_many .')' : NULL);
$voc_count += $how_many;
}
else {
if (!$suppress_unused) {
$term_list[] = $term->name;
}
}
}
if ($term_list) {
$stuff = implode(' <br /> ', $term_list); //put a break to get the list
}
else {
$stuff = t('None found');
}
$fieldset = array(
//changed terms to Categorys
'#title' => t('List by !s Categorys', array('!s' => $voc['name'])) . ($show_count ? ' ('. $voc_count .')' : NULL),
'#collapsible' => TRUE,
'#collapsed' => (count($term_list) > 50),
'#value' => '<p>'. $stuff .'</p>',
);
$output .= theme('fieldset', $fieldset) .'</div>';
}
Comments
Comment #1
nancydruThis looks like it is actually against the Indexpage module? I'm not clear on what the goal of this is either.
BTW, the plural of "Category" is "Categories."
Comment #2
nancydruMoving to the IndexPage queue.
Comment #3
nancydruI have committed this change to both branches.
Now, I'll look at a setting to choose between a list and a table.
Comment #4
nancydruOkay, there is now a setting to produce either a list- or table-formatted term list. There is also an option to show the term description in either format. And the terms now show their hierarchy.
Committed to both branches.
Comment #5
tsavino commentedThank you:)