Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer Passing Images To Popups?

    Hi everyone, first post on the forums!

    This is the basic script I am using for a photo album on a website I am designing. It uses a flat file database instead of MySQL.


    Contents of the image gallery page album.php:
    PHP Code:
    <?php 
    $lines 
    file('photos.dat'); 
    foreach (
    $lines as $line_num => $line
    {
    $tmp explode('/*/*/'$line); 
    $photo $tmp[0]; 
    $thumb $tmp[1];
    $shortdesc $tmp[2]; 
    $longdesc $tmp[3];

    echo 
    '<TABLE>';
    echo 
    '<TD><IMG SRC="'.$thumb.'"><BR>'.$shortdesc.'</TD>';
    echo 
    '</TABLE>';
    }
    ?>
    This is the format used for the arrays in the database file photos.dat:
    Code:
    ./images/photo1.jpg /*/*/ ./images/th_photo1.jpg /*/*/ Short Desc /*/*/ Long Desc
    ./images/photo2.jpg /*/*/ ./images/th_photo2.jpg /*/*/ Short Desc /*/*/ Long Desc
    (and so on)
    What I'd like to be able to do is have $photo along with $shortdesc and $longdesc passed to a new popup window (with no scrollbars and a fixed size) when the thumb is clicked on, I've tried echoing Javascript but it just doesn't seem to work, nothing happens when the thumb is clicked on. Can anyone help me out here? Thanks in advance to anyone who can.

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,474
    Thanks
    13
    Thanked 361 Times in 357 Posts
    Quote Originally Posted by otbt View Post
    What I'd like to be able to do is have $photo along with $shortdesc and $longdesc passed to a new popup window (with no scrollbars and a fixed size) when the thumb is clicked on, I've tried echoing Javascript but it just doesn't seem to work, nothing happens when the thumb is clicked on.
    do you have any JavaScript to do that, yet? passing the descriptions to the new popup window could be a little bit more difficult (depending on the size of the text), in the “worst” case, you have to make a whole new page to show the full image (instead of only passing the image URL).

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    It's pretty simple to do. Use something like (this is Javascript BTW)
    Code:
    windowHandle = window.open("", "Window Title");
    bodyHTML = '<body><div>Hello! This is a test</div></body>';
    windowHandle.body.innerHTML = bodyHTML;
    Hopefully that should give you some ideas as to how it works. It's pretty simple
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •