when i print out $cats right before i return it, the array prints out. BUT nothing returns to the main func from which it was called.
background: i send a categoryID to the function, and it gets all the subcategories, and returns all the subCategoryIDs in an array.
Code
function pnListings_userapi_getCatList($args)
{
extract($args);
if (!isset($cid)) {
$cid = '';
}
$cats[] = array('cid' => $cid);
$subcat = pnModAPIFunc('pnListings',
'user',
'getCatTree',
array('cid' => $cid));
if(!$subcat) {
print_r($cats);
die;
return $cats;
}
else
{
foreach ( $subcat as $subcatline){
pnModAPIFunc('pnListings',
'user',
'getCatList',
array(
'cid' => $subcatline[cid],
'cats' => $cats));
}
}
}
{
extract($args);
if (!isset($cid)) {
$cid = '';
}
$cats[] = array('cid' => $cid);
$subcat = pnModAPIFunc('pnListings',
'user',
'getCatTree',
array('cid' => $cid));
if(!$subcat) {
print_r($cats);
die;
return $cats;
}
else
{
foreach ( $subcat as $subcatline){
pnModAPIFunc('pnListings',
'user',
'getCatList',
array(
'cid' => $subcatline[cid],
'cats' => $cats));
}
}
}
