Include link when getting entire array? Include link when getting entire array?
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Include link when getting entire array?

Started by ericr23, September 20, 2007, 11:44:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ericr23

This is a question related to the "self-contained slideshow".

How would one get the link for each picture in the following code?

<?php
foreach ($data as $row) {
   
$imagename $objCpm->getImageToUse($row['pFilepath'], $row['pFilename'] ,"normal_");
   print 
"Pic[a++]='" $imagename "'\n";
}
?>



ericr23

With the help of another thread pointing to this page: http://cpmfetch.fistfullofcode.com/features/index.php -- I added the following line to the foreach loop:

$imagepage = "./pix/displayimage.php?pos=-" . $row['pPid'];

So the completed code is:

<?php
$a 
0;
foreach (
$data as $row) {
   
$imagethumb $objCpm->getImageToUse($row['pFilepath'], $row['pFilename'], "thumb_");
   
$imagepage "./pix/displayimage.php?pos=-" $row['pPid'];
   print 
"Pic[" $a "]='<a href=" $imagepage "><img src=./pix/" $imagethumb "></a>'\n";
   
$a $a 1;
}
?>