Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: CPMFetch show parent categories  (Read 2117 times)

0 Members and 1 Guest are viewing this topic.

anniesp04

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
CPMFetch show parent categories
« on: August 22, 2022, 03:57:34 pm »

Hello!

I'd like to know if there's an easy way to show all parent categories of an album using CPMfetch (making it look like the gallery breadcrumbs). I'd like to list my updated albums on my site showing the structure used on the gallery ( Magazine Scans > 2022 > Album title).

Using the following code, I can display only one level of parent categories (in the example above '2022'):
Code: [Select]
include_once $cpmfetch;
$objCpm = new cpm( $cpmconfig );
$objCpm->cpm_setReturnType("resultset");
$images = $objCpm->cpm_getAlbumListFrom( 'album=1,2,3,4,5,6', 1, 6);
foreach ($images as $image => $img) {
echo '<a href="' . $site_url . 'thumbnails.php?album=' . $img[pAid] . '"' . $target . '>' . $img[cName] . ' - ' . $img[aTitle] . '<br>';
}
$objCpm->cpm_close();


Getting the categories using $objCpm->cpm_getCategoryList(); and doing a series of foreach loops (one for each level of parent categories) I was kind of able to get the result, but with an enormous and most likely not efficient code, I'm not very good at coding, so I'm wondering if it's possible to get this result in a more practical (and scalable) way.

If anyone can point me in the right direction it'd be very much appreciated.

Thanks.
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.