Hi, is there a way to show categories in ascending or descending order when using we:category?
Thanks,
Michael.
we:category ordering
-
- Member
- Beiträge: 89
- Registriert: Fr 10. Mär 2006, 14:15
Hi Michael,
it is not possible to sort the categories with the wE:Tag, but there is a php script that allows you to display the categories. You should be able to alter the SQL querie accordingly.
Here's the code:
<?php
$a_Categories = array();
$out = (string) '';
$docID = (int) $GLOBALS['we_doc']->ID;
// read out all category IDs for the current document
$docCats = (string) f("SELECT Category FROM ".FILE_TABLE." WHERE ID = '$docID'",'Category',$GLOBALS['DB_WE']);
// part string and write it into an array
$a_cats = explode(',', $docCats);
// remove leading and last comma
$a_cats = array_slice($a_cats, 1, -1);
// display values for each array-entry
$a_Categories = array();
foreach($a_cats as $key => $value)
{
$a_result = (array) getHash("SELECT Category,Path FROM ".CATEGORY_TABLE." WHERE ID = '".$value."'",$GLOBALS['DB_WE']);
$a_Categories[$key]['Name'] = (string) $a_result['Category'];
$a_Categories[$key]['Path'] = (string) $a_result['Path'];
}
// p_r($a_Categories); /* Debug-display */
$out = (string) '';
foreach($a_Categories as $key => $value)
{
$out .= 'Name: ' . $a_Categories[$key]['Name'] . '
';
$out .= 'Pfad + Name: ' . $a_Categories[$key]['Path'] . '
';
$out .= '<hr />';
}
echo $out;
?>
I hope this helps.
it is not possible to sort the categories with the wE:Tag, but there is a php script that allows you to display the categories. You should be able to alter the SQL querie accordingly.
Here's the code:
<?php
$a_Categories = array();
$out = (string) '';
$docID = (int) $GLOBALS['we_doc']->ID;
// read out all category IDs for the current document
$docCats = (string) f("SELECT Category FROM ".FILE_TABLE." WHERE ID = '$docID'",'Category',$GLOBALS['DB_WE']);
// part string and write it into an array
$a_cats = explode(',', $docCats);
// remove leading and last comma
$a_cats = array_slice($a_cats, 1, -1);
// display values for each array-entry
$a_Categories = array();
foreach($a_cats as $key => $value)
{
$a_result = (array) getHash("SELECT Category,Path FROM ".CATEGORY_TABLE." WHERE ID = '".$value."'",$GLOBALS['DB_WE']);
$a_Categories[$key]['Name'] = (string) $a_result['Category'];
$a_Categories[$key]['Path'] = (string) $a_result['Path'];
}
// p_r($a_Categories); /* Debug-display */
$out = (string) '';
foreach($a_Categories as $key => $value)
{
$out .= 'Name: ' . $a_Categories[$key]['Name'] . '
';
$out .= 'Pfad + Name: ' . $a_Categories[$key]['Path'] . '
';
$out .= '<hr />';
}
echo $out;
?>
I hope this helps.
Mit freundlichen Grüssen,
Benny Johnson
Support Engineer
Living-e AG
Benny Johnson
Support Engineer
Living-e AG
Wer ist online?
Mitglieder in diesem Forum: 0 Mitglieder und 18 Gäste