I'm seriously going nuts here!!
I need to grab all content between 2 tags in a text file on my server.
example: I need all of this
START....
{ I'm just using the forum PHP feature to make it easy to see certain stuff in here
Code: Select all
<html>
<head>
<title>Title of page</title>
<META NAME='description' CONTENT='Page Desc'>
<META NAME='keywords' CONTENT='keywords,keywords'>
<link rel='stylesheet' href='style.css' type='text/css'>
<script type='text/javascript' language='JavaScript1.2' src='reload.js'></script>
</head>
<body bgcolor='#FFFFFF' text='#000000'>END....
out of the text file/page into variable(s) so that I can write them back to the file.
Why do I need to do this???
I am working on a template system that uses a MSHTML WYSIWYG editor and because of the MSHTML crap, I can only get everything BETWEEN the <body> Only this source </body> tags into the WYSIWYG edit field.
So when the page editing is done, and you click save, it only writes
Code: Select all
<table>
<tr>
<td> whatever is in the body of the page </td>
</tr>
</table>When I was using just a textarea field it was fine.. But for someone that does not know html, that would be impossible to edit a page looking at a bunch of code.
I use this to OPEN FILE
Code: Select all
$file_content_read = implode("",file("$dir/$fne"));
$file_content = stripslashes($file_content_read);Once the changes are made and save is clicked WRITE TO FILE
Code: Select all
if($commit_edit)
{
$content = stripslashes($file_content);
$fp = fopen("$dir/$fn","w") or die ("Error opening file in write mode!");
fputs($fp,$content);
fclose($fp) or die ("Error closing file!");
}an actual sample code to do this would be EXCELLENT!
Thank you in advance
Chris
PS I'm on a time crunch here.. so any ideas would do..