coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: niks_007 on September 10, 2006, 05:47:04 AM

Title: Listing Albums
Post by: niks_007 on September 10, 2006, 05:47:04 AM
Dear Friends i have tried out the cpm fetch to meet my requirment but having some problem please help me out




<?
include "cpmfetch.php";
$objCpm = new cpm('/wallpapers');

$objCpm->cpm_setReturnType("resultset");
$data = $objCpm->cpm_viewLastAddedMediaFrom(1000, 1000, "cat=5");

$cnt = 0;
$arrayofalbums = array();

foreach ($data as $row) {
if (! in_array($row['aTitle'],$arrayofalbums)) {

print $row['aTitle'];
print "";
print "\n";
array_push($arrayofalbums,$row['aTitle']);
$cnt++;
print "<br>";
if ($cnt == 6) break;
}
}



?>


this code is not showing the link to the concern album. i want the list of albums to be linked so one can click on it.

Aishwarya Rai
Rakhi Sawant
Negar Khan
Preity Zinta
Tanushree Dutta
Rimi Sen

it is showing like above but the title of album are not linked with there album..

please modify the code so the albums can also be linked.

Thanks
Title: Re: please update the code
Post by: Joachim Müller on September 10, 2006, 08:39:54 AM
Moving thread to sub-board where you should have posted in the first place.
Title: Re: Listing Albums
Post by: vuud on September 10, 2006, 05:05:10 PM

Why don't you just change your print statement to make a url to your coppermine gallery?  Look at the way the CPG references albums and stick it in.

Links to albums in CPG look like so:
http://www.fistfullofcode.com/photos/thumbnails.php?album=6

So you need to work in your own album, and set it with the 'pAid' that gets returned in row



            foreach ($data as $row) {
if (! in_array($row['aTitle'],$arrayofalbums)) {

print '<a href="http://www.fistfullofcode.com/photos/thumbnails.php?album=' . $row[pAid] . '"\>";
print $row['aTitle'];
print '</a>';
print "";
print "\n";
array_push($arrayofalbums,$row['aTitle']);
$cnt++;
print "<br>";
if ($cnt == 6) break;
}
}



I did not test it, but that should work... work out any syntax errors I may have in there.