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
Share on other sites

While this seems to be largely a javascript problem... My initial guess is to remove the "href=" portion of the addUrlSelect function.... Also, those extra parentheses don't make sense to me... how exactly is this being added to the URL?

Link to comment
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

 

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.