ambo Posted February 19, 2009 Share Posted February 19, 2009 Is it possibile for you to use fopen to open a php file on server into a form textarea edit it and fwrite Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/ Share on other sites More sharing options...
premiso Posted February 19, 2009 Share Posted February 19, 2009 "Can you do *insert thing*?" Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/#findComment-766144 Share on other sites More sharing options...
ambo Posted February 19, 2009 Author Share Posted February 19, 2009 Well my question is based more on the fact of if you can open and view the php file as if you were in say dreamweaver my objective is to have a way to have administrators edit the site from logging in so is there a violation that fopen will not open the php document Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/#findComment-766363 Share on other sites More sharing options...
premiso Posted February 19, 2009 Share Posted February 19, 2009 I would think that if another program is using it it should "lock" the file or set it to readonly. But I do not know how dreamweaver works. But why did you not state that in the first place? You need to be alot more clearer on exactly what you want. Even your 2nd response is vague. Please be more elaborate and descriptive. I could write solutions, but I do not want to write 50 when you only need one. Right now I am guess/assuming what you are asking. Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/#findComment-766389 Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 I would think that if another program is using it it should "lock" the file or set it to readonly. But I do not know how dreamweaver works. But why did you not state that in the first place? You need to be alot more clearer on exactly what you want. Even your 2nd response is vague. Please be more elaborate and descriptive. I could write solutions, but I do not want to write 50 when you only need one. Right now I am guess/assuming what you are asking. I use Dreamweaver and it doesn't lock files. However if you make changes to it from another program, it will detect it once you go back to DW. Other than that, i still don't know what the OP wants to do... Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/#findComment-766393 Share on other sites More sharing options...
ambo Posted February 19, 2009 Author Share Posted February 19, 2009 I want to be able to edit hard code on my website editing page files from the page so i can add blocks of code anywhere aka "on the fly" say at work with nothing else to do then be able to browse to the page and hit refresh and see the changes Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/#findComment-766522 Share on other sites More sharing options...
premiso Posted February 19, 2009 Share Posted February 19, 2009 I want to be able to edit hard code on my website editing page files from the page so i can add blocks of code anywhere aka "on the fly" say at work with nothing else to do then be able to browse to the page and hit refresh and see the changes Yes and no. You can do this with PHP but the file has to be put into a textarea on the webpage and you would have to manually copy then paste back then click "Save". If anyone else accesses this file while you are working on it, their's or your changes will be overwritten. Perhaps you are looking for a Subversion server (which you can setup for free on any windows machine and give access to anyone with username/password authentication). This keeps a log of any/all files changed and lets you know if a file was changed while you were working on it/allows you to lock that file you are working on. Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/#findComment-766526 Share on other sites More sharing options...
ambo Posted February 19, 2009 Author Share Posted February 19, 2009 I will be the only one with access but can you explode it into a array then echo it into the value field on text area or would it try and execute what code is in the file when echoed>>? Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/#findComment-766534 Share on other sites More sharing options...
premiso Posted February 19, 2009 Share Posted February 19, 2009 You would just use: $contents = file_get_contents("filename.php"); echo '<textarea name=file rows=30 cols=70>' . $contents . '</textarea>'; Quote Link to comment https://forums.phpfreaks.com/topic/145938-question-about-fopen/#findComment-766547 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.