Re: Edit a file

From: Date: Sun, 18 May 2003 17:27:21 +0000
Subject: Re: Edit a file
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-148097@lists.php.net to get a copy of this message
Yes, you'll see that in the docs. It ain't a text editor - so read in and write out until you get to the part you want to tchange, write that and then write out the rest of it. You'll also notice there are various parameters for fopen() Alternately - boilerplate beginning and end, with your script section as a fragment. Make changes to the script section, them wrap all 3 in a fourth file and include() them. There's more than one way to do this stuff. Regards - Miles Thompson At 04:18 PM 5/18/2003 +0100, shaun wrote:
Thanks for your reply, but this question is different! what i am trying to do is create a script that replaces a certain part of a page e.g. everything between the <script> </script> tags. The problem i found with the fopen() function is that writing to a file automatically wipes the original content from the file... "David Otton" <phpmail@jawbone.freeserve.co.uk> wrote in message news:lf7fcv0vg7vvgoanbpr0udt2bnpfs7iq2j@4ax.com... On Sun, 18 May 2003 15:33:05 +0100, you wrote:
How can i open a file and change the contents of everything in the file
that
lands between the <script> </script> tags?
I'm sure this is the second time you've asked this question, and you already got one answer with example code. What exactly are you trying to accomplish? Open a file: fopen() http://www.php.net/manual/en/function.fopen.php Read the contents of a file: file(), fread(), fgets(), etc. http://www.php.net/manual/en/ref.filesystem.php To modify a string once it's in memory: string and regex functions http://www.php.net/manual/en/ref.strings.php http://www.php.net/manual/en/ref.pcre.php http://www.php.net/manual/en/ref.regex.php Without a more specific question, you're unlikely to get more specific help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#148097) next »