Results 1 to 3 of 3

Thread: Parsing php variables to dhtml window widget

  1. #1
    Join Date
    Nov 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Parsing php variables to dhtml window widget

    ) Script Title: DHTML WINDOW WIDGET

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ndow/index.htm

    3) Describe problem:


    i'm trying to use a PHP variable in the Popup window

    here is my current script

    PHP Code:
    function CALL_POPUP_SATALLITE($image_url,$file)
    {
        
        
        echo 
    '<script type="text/javascript">
    function openmypage_sat(){ //Define arbitrary function to run desired DHTML Window widget codes
    ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "sat_pop.php", "Satallites", "width=450px,height=300px,left=300px,top=100px,resize=1,scrolling=1")
    ajaxwin.onclose=function(){return window.confirm("Close SYNOP?")} //Run custom code when window is about to be closed
    }
    </script>

    <a href="#" onClick="openmypage_sat(); return false">Image</a>

    '
    ;
        
        


    Now this function is used several times on one page So im wanting to be able to parse a variables $image_irl and $file through to the popup window so after clicking the link


    any ideas ?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    It's hard to tell from just the code above what you're trying to do. In general you can use a server side language like PHP to output any HTML, JavaScript included. To make things cleaner for you though, you should only output the portion of the JavaScript you need to dynamically, and leave the rest alone. So for example, in the below JavaScript code, only the URL of the popup window is dynamically generated using PHP:

    Code:
    <script type="text/javascript">
    
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "<? echo $popurl ?>", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")
    
    googlewin.onclose=function(){ //Run custom code when window is being closed (return false to cancel action):
    return window.confirm("Close window 1?")
    }
    
    </script>
    DD Admin

  3. #3
    Join Date
    Nov 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks i'll give that a try .... thanks for your replay

Bookmarks

Posting Permissions

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