Advanced search  


cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.

Pages: [1]   Go Down

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

0 Members and 1 Guest are viewing this topic.


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


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 );
$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>';

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.

Pages: [1]   Go Up

Page created in 0.021 seconds with 19 queries.