Re: extract/replace the content of html pages
| From: | Martin Helie | Date: | Sat, 03 Jan 2004 00:44:26 +0000 |
| Subject: | Re: extract/replace the content of html pages | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173660@lists.php.net to get a copy of this message | ||
Not sure I understand, but it sounds like you'd want to do something like:
$dir = "yourdir/";
$d = dir( $dir );
while (false !== ($file = $d->read())) {
if( substr( $file, 0, 1 ) == "." ) {
continue;
}
$fp = fopen( $dir . $file, "r" );
$contentArray = split( "<!--[a-z ]-->", fread( $fp, $file, filesize(
$dir . $file ) ) )
//deal with $contentArray here
fclose( $fp );
}
Is that what you had in mind?
"Jlake" <jalake@idealpromotional.com> wrote in message
news:20040102224433.73796.qmail@pb1.pair.com...
> Hello
>
> I have a folder full of html pages that I need to extract the content
from.
> They all have <!-- content start --> and <!--content end --> comment tags
> surrounding the content. I need an easy way (not one at a time) to extract
> that content and place it in a new template.
>
> Any ideas are appreciated. Im assuming it will have to be some sort of
> strpos and substr thing, but I'm not sure how to automate my process
>
> Thanks,
>
> J.