#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    372
    Rep Power
    12

    Question Use PHP $Variables inside JavaScript Pop-Up Window Code?


    ::Question For The Members::

    Does anyone know how I can make PHP variables set the "width" and the "height" of the thumbnail image for a JavaScript pop-up window function?

    The JavaScript code below works just fine using the PHP term $Row->PictureOne to extract the image URL from the MySQL database. However, when I try to insert PHP variables like $Row->ImgHeight and $Row->ImgWidth (in place of the 100 and the 67 below) to extract the width and height from the MySQL database it won't work.


    <a href=# onClick=MM_openBrWindow('./articles/images/$Row->PictureOne','ArticleImage1','scrollbars=yes,resizable=yes,width=600,height=400')><img src='./articles/images/$Row->PictureOne' width=100,height=67 border=0></a>

    In the header of the HTML page I'm using following code:

    <!--
    function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
    }
    //-->


    I would appreciate any help.

    Thanks.

    Volitics
    Last edited by Volitics; October 22nd, 2002 at 11:36 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Pittsburgh, PA
    Posts
    54
    Rep Power
    13
    Please post the code where you attempt this. Are you using the "$Row->xxx" references in the PHP code that generates your page or in the JavaScript on the page itself?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    372
    Rep Power
    12
    Thank you for your response. I was using the "$Row->xxx" format. The numbers that I want to change are the numbers "100" and "67" (the height and width of the small image display window). I was using the "$Row->xxx" format in place of the numbers 100 and 67 (please see below).

    PHP Code:
    require_once "./folder/config.inc";
    $TableName "KnoxPost";
    $Query "SELECT Content_id, HeadLine, ArtDate, Leader, PictureOne FROM $TableName WHERE Section = 'topstor' ORDER BY Content_id DESC LIMIT 3";
    $Result mysql_db_query ($db_info[dbname], $Query$db_connection);

    // Fetch the results from the database.

        
    while ($Row mysql_fetch_object ($Result)){
         print (
    "<TR VALIGN=TOP><TD ALIGN=LEFT VALIGN=TOP><a href=./articles/report.php?Content_id=$Row->Content_id CLASS=nwstt5b>$Row->HeadLine</a></TD></TR>\n");
         print (
    "<TR VALIGN=TOP><TD ALIGN=LEFT VALIGN=TOP><TABLE BORDER=0 WIDTH=100%><TR><TD WIDTH=119 CLASS=title2>$Row->ArtDate</TD><TD><a href=./articles/report.php?Content_id=$Row->Content_id><img src=./images/go.gif width=65 height=17 border=0></a></TD></TR></TABLE></TD></TR>\n");         
         print (
    "<TR VALIGN=TOP><TD ALIGN=LEFT VALIGN=TOP><TABLE BORDER=0><TR><TD CLASS=title4>$Row->Leader</TD>\n");
         
             if (
    "$Row->PictureOne") {
             print (
    "<TD><a href=# onClick=MM_openBrWindow('./articles/$Row->Content_id/$Row->PictureOne','ArticleImage1','scrollbars=yes,resizable=yes,width=600,height=400')><img src='./articles/$Row->Content_id/$Row->PictureOne' width=100,height=67 border=1></a></TD>\n");
            }             
         
         print (
    "</TR></TABLE></TD></TR>\n");
         print (
    "<TR VALIGN=TOP><TD ALIGN=LEFT VALIGN=TOP><hr></TD></TR>\n");          
        }
    mysql_close ($db_connection);            
    print (
    "</TABLE>\n"); 
    Thanks. Volitics

IMN logo majestic logo threadwatch logo seochat tools logo