dmikester1 Posted December 13, 2007 Share Posted December 13, 2007 I am trying to figure out how to get the content from a file loaded into a popped up window's content area when an "edit" link is clicked. The edit link will be right next to the name of the file in my directory listing app. Thanks Mike Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 13, 2007 Share Posted December 13, 2007 maybe ajax? or you can use the plain js to open a certain page and resize the window and remove the adress bar etc.. Quote Link to comment Share on other sites More sharing options...
JakeTheSnake3.0 Posted December 13, 2007 Share Posted December 13, 2007 Your pop-up html page should be a .php file somewhere on your server. In that php file, you'll get your file name via $_GET[]. You take the filename and use that to point to a file. echo the fread() of that file to the user. Quote Link to comment Share on other sites More sharing options...
dmikester1 Posted December 13, 2007 Author Share Posted December 13, 2007 Well, i have the popup working. I just need to load the relevant content into it. Here is the line that pops up the file editor: win = window.open('FileEditor.php?dir=<?=$_GET['dir']?>','window','height=600, width=700,toolbar=no,directories=no, status=no, menubar=no,scrollbars=no,resizable=yes'); Quote Link to comment Share on other sites More sharing options...
JakeTheSnake3.0 Posted December 13, 2007 Share Posted December 13, 2007 First off, I hope the variable 'dir' is only pointing to a partial location and not the full location of your file. Secondly, use file_get_contents() to load the contents of a given file as a string which you can echo. Quote Link to comment Share on other sites More sharing options...
dmikester1 Posted December 13, 2007 Author Share Posted December 13, 2007 No, 'dir' is the folder name where I currently am when I click on the link. I have my app listing out all the files in the directory automatically and it sticks an "edit" link next to each filename. How can I pass the name of the file onto the FileEditor.php popup when I click "edit"? Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 13, 2007 Share Posted December 13, 2007 just the same as passing the id FileEditor.php?dir=<?=$_GET['dir']?>&file = yourfile Quote Link to comment Share on other sites More sharing options...
dmikester1 Posted December 14, 2007 Author Share Posted December 14, 2007 Thanks Teng, I got it to pass the name of the file in the URL. Now how do I obtain that in the new window? Thanks Mike Quote Link to comment 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.