View Full Version : Parsing php variables to dhtml window widget

01-26-2009, 10:39 AM

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

3) Describe problem:

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

here is my current script

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

<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 ?

01-27-2009, 05:41 AM
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:

<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?")


01-27-2009, 06:46 AM
thanks i'll give that a try .... thanks for your replay :)