Betreff: Aw: MyAlbum-P für Xoops 2.5.11 von WDC am 12.03.2021 19:18:49
Neeee, bekomme ich nicht gebacken
es gibt das was ähnliches, in der php Datei, das liest wohl das aus, was ich suche, bekomme das aber nicht in Deinen code portiert
foreach ($GLOBALS['cattree']->getAllChild($cid) as $child) {
$cids[$child->getVar('cid')] = $child->getVar('cid');
}
$cids[] = $cid;
$criteria = new CriteriaCompo(new Criteria('status', '0', '>'));
$photo_total_sum = Utility::getTotalCount($cids, $criteria);
if (!empty($cids)) {
foreach ($cids as $index => $child) {
$childcat = $catHandler->get($child);
if (is_object($childcat)) {
$catpath .= "<a href='" . $helper->url() . 'viewcat.php?num=' . (int)$GLOBALS['merchandise_perpage'] . '&cid=' . $childcat->getVar('cid') . "' >" . $childcat->getVar('title') . '</a> ' . ($index < count($cids) ? '>>' : '');
}
}
} else {
$cat = $catHandler->get($cid);
$catpath .= "<a href='" . $helper->url() . 'viewcat.php?num=' . (int)$GLOBALS['merchandise_perpage'] . '&cid=' . $cat->getVar('cid') . "' >" . $cat->getVar('title') . '</a>';
}
So habe ich es probiert, aber das Ergebnis ist leer
/**
* Get all parents of a category
* @param $albPid
* @return string
*/
function getParentsOfCategory($cat)
{
$parentsAll = [];
/** @var XoopsModulesWggalleryHelper $helper */
$helper = XoopsModulesWggalleryHelper::getInstance();
$albumsHandler = $helper->getHandler('Category');
$crAlbums = new CriteriaCompo();
$crAlbums->add(new Criteria('cid', $cid));
$albumsCount = $albumsHandler->getCount($crAlbums);
$albumsAll = $albumsHandler->getAll($crAlbums);
// Table view albums
if ($albumsCount > 0) {
foreach (array_keys($albumsAll) as $i) {
$parentsAll[] = ['cid' => $albumsAll[$i]->getVar('cid'), 'title' => $albumsAll[$i]->getVar('title'), 'pid' => $albumsAll[$i]->getVar('pid')];
$parent = getParentsOfCategory($albumsAll[$i]->getVar('pid'));
if ($parent) {
$parentsAll[] = $parent;
}
}
}
return $parentsAll;
}
|