Jump to content

reading contents of file into a window


dmikester1

Recommended Posts

I have my site listing out a bunch of files, one per row.  In each row there is an "edit" link next to each filename.  Right now, when that link is clicked a new window pops up with a blank file editor.  There is nothing in the content area.  Can someone explain to me how to pass the contents of the file next to the "edit" clicked into that window.

Thanks

Mike

Link to comment
https://forums.phpfreaks.com/topic/86386-reading-contents-of-file-into-a-window/
Share on other sites

I have the edit link attached to a js function with "onclick".  Here is that JS code:

function popup(filename)
{
if(filename != "") {
  win = window.open('FileEditor.php?dir=<?=$_GET['dir']?>&file='+filename,'window','height=600, width=700,toolbar=no,directories=no, status=no, menubar=no,scrollbars=no,resizable=yes');
}
else {
  win = window.open('FileEditor.php?dir=<?=$_GET['dir']?>&file=','window','height=600, width=700,toolbar=no,directories=no, status=no, menubar=no,scrollbars=no,resizable=yes');
}
win.moveTo(100,100);
return false;
}

 

Now, the filename is in php and I don't know how to pass it to the javascript.

It's a long one.  Here is the code that generates a single line with the filename and edit link on it.

<tr class="<?=$class;?>" id="file<?=$i;?>"><td><img src="images/<?=$icon;?>" alt="<?=$files[$i];?>" /></td><td id="<?=finame.$i;?>"><a href="<?=$fileurl;?>"><?=$thumb2;?><?=$filename;?></a></td><td class = "edit"><a href="#" onclick="javascript:popup(none)">edit</a></td><td><em><?=round(filesize($leadon.$files[$i])/1024);?>KB</em></td><td class="date"> <?=date ("M d Y h:i:s A", filemtime($leadon.$files[$i]));?><?=$thumb;?></td><td class="checkbox"><input type="checkbox" name="filebox<?=$i;?>" id="filebox<?=$i;?>" value="" onclick="highlightRow(this);" /></td></tr>

Thanks

Mike

Archived

This topic is now archived and is closed to further replies.

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