This is the whole patch of code im trying to rewrite for my website.
//collect links and generate cache files
function cacheFiles() {
if ($this->error) return false;
$this->clearCache();
$mylinks = array();
$mycontent = @file_get_contents($this->url);
$mylinks = $this->get_href($mycontent);
//expanding with the incl array
if ($this->incl) $mylinks = array_merge($mylinks,$this->incl);
$this->collectUrls($mylinks, $this->url);
$this->checkUrls($this->checkUrls);
$this->checkedUrls = array_values(array_unique($this->checkedUrls));
$cnturls = count($this->collectedUrls);
$y = 0;
for ($i=0;$i<$cnturls;$i++) {
$mycontent = @file_get_contents($this->collectedUrls[$i]);
if ($mycontent) {
//find page title
preg_match_all("/<title(.*)>(.*)<\\/title>/i", $mycontent,$tarr);
$title = $tarr[2][0];
//cut till body if body :)
if (stristr($mycontent,"<!--DIE NOT MODIFY -->")) $body = substr($mycontent,stripos($mycontent,'<!--die'));
else $body = $mycontent;
$body = $this->br2nl($body);
$body = strip_tags($body);
$body = preg_replace('/\
/', " ", $body);
$body = preg_replace('/\\s{2,}/', " ", $body);
$this->write($y.".txt",$body);
$cache_data .= '$cache_data[' . $y . '] = array("url" => "' . addslashes($this->collectedUrls[$i]) . '",
"title" => "' . addslashes($title) . '");' . "\
";
$y++;
}
}
if ($cache_data) $this->write("data.php",'<?php' . "\
$cache_data\
?".'>');
}
The Part im having trouble with is this.
if (stristr($mycontent,“<!–DIE NOT MODIFY –>”)) $body = substr($mycontent,stripos($mycontent,‘<!–die’));
I modified this part so that when in my pages when it see’s <!–DIE NOT MODIFY –> This is where it Begins Reading whats on the page, caches all the text into a text file and adds it to the search engine.
How do i add something like
<!–//DIE NOT MODIFY –>
To The end of the content section so that the search process/cache process Stops at that tag.
So instead of starting at <!–DIE NOT MODIFY –> then copying all text from then to the bottom to do this instead
Copy text past <!–DIE NOT MODIFY –> and stop copying at <!–//DIE NOT MODIFY –>