[thelist] Using PHP to write CSS
Burhan Khalid
burhankhalid at members.evolt.org
Mon May 20 14:44:01 CDT 2002
[ snip ]
> would something like this help you?
>
> $body = str_replace("%uname%", $uname, $body);
>
> %uname% = string in file to be replaced
> $uname = php variable to replace the string
> $body = the file to search and replace in
>
[ /snip ]
I am assuming that the $body in this example is all of the text in a file. I
am trying to avoid reading the entire file in order to replace just one
thing.
Seems kinda cumbersome to have to read everything, store it, search &
replace, write it back. What I would like to be able to do is just use the
following information :
1. string to look for
2. where to look for it (file name)
3. what to replace it with
and have PHP "scan" the file (without having to store it as a variable in my
script), replace the text, save the file, so that I can include it.
good idea though,
Burhan
More information about the thelist
mailing list