I have a script I wrote, and it's about 40 KB in size, and it's nearly HALF html and HALF php code.
I need to be able to turn this ENTIRE 40 KB file, into one LONG PHP string. The reasons for doing this are my own reasons, but I just need to be able to have the ENTIRE file, in a PHP string var like $file_string.
So if I did <? echo $file_string; ?> , it would be the EXACT same as if I just did <? include $external_40kb_file; ?>.
Can I get some assistance.
Also, after that, if I could run a script on the $file_string var, and remove ALL tags, so I can see the code as search engines would see it, that would be lovely.
Code: Select all
############### The file allready exists
if(file_exists($basedir.$filelocation))
{
$lastaction = "$file allready exists.";
html_header();
displaydir();
}
############### Give the user a textarea to write the contents of file
else
{
$lastaction = "Creating $file";
html_header();
echo "<FORM METHOD=\"POST\" ACTION=\"$PHP_SELF\">\n";
echo "<INPUT TYPE=\"HIDDEN\" NAME=\"file\" VALUE=\"$file\">\n";
echo "<INPUT TYPE=\"HIDDEN\" NAME=\"action\" VALUE=\"createfile\">\n";
echo "<INPUT TYPE=\"HIDDEN\" NAME=\"wdir\" VALUE=\"$wdir\">\n";
echo "<INPUT TYPE=\"HIDDEN\" NAME=\"done\" VALUE=\"1\">\n";
echo "<TEXTAREA NAME=\"code\" rows=\"$textrows\" cols=\"$textcols\">\n";
############### The user selected to use a html template. Put it inside the textarea
if(isset($html))
{
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n\n";
echo "<html>\n";
echo "<head>\n\n";
echo "<title>Untitled</title>\n";
echo "</head>\n";
echo "<body>\n\n";
echo "</body>\n";
echo "</html>";
}
echo "</TEXTAREA><BR>\n";
echo "<center><INPUT TYPE=\"SUBMIT\" NAME=\"confirm\" VALUE=\"Create\">\n";
echo "<INPUT TYPE=\"SUBMIT\" NAME=\"cancel\" VALUE=\"Cancel\"><br>";
$ext = strrchr ( $file , "." );
if(!strcasecmp ($ext, ".txt"))
{
echo "<input type=\"checkbox\" name=\"convert\" value=\"yes\"><font size =\"-2\" face=\"arial, helvetica\">(convert line returns to BR)</font> ";
}
echo "</center><BR>\n</FORM>";
}
}
echo $html_ender;
break;
}
?>