RE: [PHP] stripping code from another file
| From: | Jason | Date: | Thu, 27 Jul 2000 17:23:17 +0000 |
| Subject: | RE: [PHP] stripping code from another file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8598@lists.php.net to get a copy of this message | ||
Let's try this again. Never really used PageMill before so I'm unsure.
Just in case the code doesn't come across, I'll paste it to the bottom of
this post.
Jason
> on 7/27/00 10:02 AM, Jason (jasonc@webpipe.net) wrote:
>
> > This might not relate exactly to your question but I though I might post
> > this code anyway. I've written a little function that will
> take an included
> > HTML document and return only the HTML portion contained within the body
> > tags. It's great for including pages within pages. I've
> attached the code
> > if anyone's interested.
> >
> > Jason
>
> I'm interested, but the code wasn't attached. :)
>
> Do you think that that code could be included in an auto append / prepend
> file? I'd like for some users of my site to be able to edit in PageMill,
> etc, but still keep the standard headers and footers of my site.
>
> Paul
function striptags($inputfile)
{
$Array = file($inputfile);
$BiggestFile = implode("", $Array);
if (!$TopBody = strpos(strtolower($BiggestFile), "<body"))
{
echo "Error, could not find body tag";
return false;
}
$BiggerFile = substr($BiggestFile, $TopBody);
if (!$TopEndBody = strpos($BiggerFile, ">"))
{
echo "Error, could not find end body of tag";
return false;
}
$BigFile = substr($BiggerFile, $TopEndBody+1);
if (!$BottomBody = strpos(strtolower($BigFile), "</body>"))
{
echo "Error, could not find end body tag";
return false;
}
$SmallFile = substr($BigFile, 0, $BottomBody);
return $SmallFile;
}
<? function striptags($inputfile) { $Array = file($inputfile); $BiggestFile = implode("", $Array); if (!$TopBody = strpos(strtolower($BiggestFile), "<body")) { echo "Error, could not find body tag"; return false; } $BiggerFile = substr($BiggestFile, $TopBody); if (!$TopEndBody = strpos($BiggerFile, ">")) { echo "Error, could not find end body of tag"; return false; } $BigFile = substr($BiggerFile, $TopEndBody+1); if (!$BottomBody = strpos(strtolower($BigFile), "</body>")) { echo "Error, could not find end body tag"; return false; } $SmallFile = substr($BigFile, 0, $BottomBody); return $SmallFile; } ?>
<? function striptags($inputfile) { $Array = file($inputfile); $BiggestFile = implode("", $Array); if (!$TopBody = strpos(strtolower($BiggestFile), "<body")) { echo "Error, could not find body tag"; return false; } $BiggerFile = substr($BiggestFile, $TopBody); if (!$TopEndBody = strpos($BiggerFile, ">")) { echo "Error, could not find end body of tag"; return false; } $BigFile = substr($BiggerFile, $TopEndBody+1); if (!$BottomBody = strpos(strtolower($BigFile), "</body>")) { echo "Error, could not find end body tag"; return false; } $SmallFile = substr($BigFile, 0, $BottomBody); return $SmallFile; } ?>