dmikester1 Posted January 16, 2008 Share Posted January 16, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/86386-reading-contents-of-file-into-a-window/ Share on other sites More sharing options...
teng84 Posted January 16, 2008 Share Posted January 16, 2008 you need to add a query string that will contain let say id's something like link.php?id=1 so when you click the link the other page will process your query string and search / display the record having 1 as an id Quote Link to comment https://forums.phpfreaks.com/topic/86386-reading-contents-of-file-into-a-window/#findComment-441425 Share on other sites More sharing options...
dmikester1 Posted January 17, 2008 Author Share Posted January 17, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/86386-reading-contents-of-file-into-a-window/#findComment-441442 Share on other sites More sharing options...
teng84 Posted January 17, 2008 Share Posted January 17, 2008 may is see where and how you call this JavaScript function Quote Link to comment https://forums.phpfreaks.com/topic/86386-reading-contents-of-file-into-a-window/#findComment-441443 Share on other sites More sharing options...
dmikester1 Posted January 17, 2008 Author Share Posted January 17, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/86386-reading-contents-of-file-into-a-window/#findComment-441447 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.