Jump to content

popup thumbnails when selecting rows


joeros

Recommended Posts

i have the following code that i am trying to adapt.

 

$x->addRowSelect("alert('You have selected id # %url%')");


/**
* Adds ability to select a entire row
*
* @param string $onclick The JS function to call when a row is clicked
*/
public function addRowSelect($onclick)
{
	$this->row_select = $onclick;
}


// Handle row selects
if ($this->row_select)
            echo ' tbl-row-highlight" onclick="' . $this->parseVariables($row, $this->row_select);

echo '">';

 

What happens is that when a row is clicked a pop window appears and gives the details of the specified field.

What i am trying to do is have a window popup with a jpg picture instead. what i have done is this

 


$x->addUrlSelect("href=(javascript:openpopup('tnail.jpg'))");

<script>
function openpopup(popurl){
winpops=window.open(popurl,"","width=400,height=338,")
}
</script>

        public function adUrlSelect($openpopup)
{
	$this->url_select = $openpopup;
}

 

Now as far as i can see everything is syntactically correct but is not working. Can anyone advise as to where i am going wrong please?

 

as usual thanks for any replies

 

Link to comment
https://forums.phpfreaks.com/topic/205300-popup-thumbnails-when-selecting-rows/
Share on other sites

Hi,

i removed the parentheses and fixed the spelling mistake (addUrl). still no work. as this is not originally my code the way i read is this,

Addurlselect takes the url address to the openpopup function which 'should' create a jpg popup image but obviously does not.

 

as i said i have read the original code and this is what it seems to do so i made what i thought was the appropriate changes

 

It might help to have the original code... otherwise, it's just shots in the dark.

 

I agree and i have only been coding php for just over a week so i am very inexperienced, however i thought there was enough info there for a reasonable php programmer to steer me in the correct direction.

 

Anyway, i have almost been able to work it out myself. All i needed to do was instead of duplicating code and changing parameters i just need to change this line

 

$x->addRowSelect("alert('You have selected id # %url%')");

 

so that it becomes

 

$x->addRowSelect("window.open('%url%')");

 

this opens the jpg in a new window but it is a full size window. i just want the thumbnail to open in a small window as a jpg.

 

Any pointers?

 

http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

 

Change Height and Width by: (example)

 

window.open ("http://www.javascript-coder.com",
"mywindow","menubar=1,resizable=1,width=350,height=250"); 

 

To get height and width of image, you can use the getimagesize() function in PHP:

 

http://php.net/manual/en/function.getimagesize.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.