Forum Moderators: coopster

Message Too Old, No Replies

Can't find next image

Trying to pass an array of filenames to another function.

         

grggfks

9:52 pm on Nov 7, 2009 (gmt 0)

10+ Year Member



I'm setting up some anchors in a page of thumbnails like so....

$series = $gdb->Select("select * from images where groupid=$id order by id desc limit $start, $maxPage");
for ($x=0; $series[$x]; $x++)
{
$rec = $series[$x];
$id= $rec["id"];
$hash= $rec["hash"];
$filnames[$x] = $hash;

$img = new htmlTag("img");

$a = new htmlTag("a");
$a->href="javascript:window_show_pos('RequestWindow', 'index.php?getLarge=$hash&filenames&x&direct$next=0', -9, -4);

$a->set($img);
$a->render();
}

// I have no problem passing $hash to function getLarge() and showing the selected image but, the only way I see to go to the next image without going beck to the thumbnails is to pass the array of filenames[] = $hash.

function getLarge($hash, $filenames)
{
global $gdb, $gMobile;

print '<div align=left style="background-color:white;">';

//Tool bar for large image navigation
$Toolbar = array();
$Toolbar[] = array(140, "javascript:window.open('/full/$name.jpg','no','scrollbars=yes,width=1100,height=800');", "ZOOM");
$Toolbar[] = array(140, "javascript:window_hide('RequestWindow');", "CLOSE");

//next image call
$Toolbar[] = array(140, "javascript:window_show('RequestWindow', 'index.php?getLarge=$name&filenames[]&x&next=1', -9, -4);", "NEXT") ;

Toolbar($Toolbar);

print"</div>";


print '<div align=left style="background-color:white;">';

// Index to NEXT image here and show


if(Param("next"))
{
$x = Param("x") + 1;
$nextname = Param("filenames[$x]");



print "<a href=\"javascript:window_hide('BigWindow');\"><img src='/full/$nextname.jpg' border=0 width=600></a>";

//this one works fine
if(Param("direct"))
{

print "<a href=\"javascript:window_hide('BigWindow');\"><img src='/full/$hash.jpg' border=0 width=600></a>";

}

I am unsure about passing the array because I cannot print out the same image using filenames with the proper '$x'.It does not show the image as $hash does.

I know that the function getLarge() should not have brackets to show that it is an array but should the call to the function 'index.php?getLarge=$name&filenames[]&x&next=1' have brackets? I also don't seem to getting a value for 'x' in getLarge().

I'm very new to php. I'm a c++ programmer and my developer is out for a month or so for personal reasons and I'm trying to make some changes in his absence. Passing variables has been a problem. Hope someone can help.

dreamcatcher

7:01 pm on Dec 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks like this one has everyone confused grggfks. Did you have any joy yourself?

dc