new id2name parameter $item="path" to get a / delimited path of the cat hierarchy (names of the parents)

This commit is contained in:
Ralf Becker 2008-02-07 02:40:43 +00:00
parent 0a716b3342
commit b2be83b0da

View File

@ -648,7 +648,7 @@
* We use a shared cache together with return_single
*
* @param int $cat_id=0 cat-id
* @param string $item='name requested information
* @param string $item='name requested information, 'path' = / delimited path of category names (incl. parents)
* @return string information or '--' if not found or !$cat_id
*/
function id2name($cat_id=0, $item='name')
@ -659,9 +659,18 @@
if (!$item) $item = 'parent';
if ($this->cache_id2cat_data[$cat_id][$item])
$cat = $this->cache_id2cat_data[$cat_id];
if ($item == 'path')
{
return $this->cache_id2cat_data[$cat_id][$item];
if ($cat['parent'])
{
return $this->id2name($cat['parent'],'path').' / '.$cat['name'];
}
$item = 'name';
}
if ($cat[$item])
{
return $cat[$item];
}
elseif ($item == 'name')
{