PDA

View Full Version : Anyone know how...



maverick
08-10-2006, 11:55 PM
Hi,

I have a site with alot of pages and I would like to find a script that would allow me to post a code in the links box and be able to add or remove links without having to do it page by page.Like with a admin part or similar.Any help is most greatly appreciated

Kind regards

Mav

ItsMeOnly
08-11-2006, 12:03 AM
include "links.inc"?:)

But seriously, if there files are scattered across countless directories, it will be much more difficult.

Gona take some time to write that, but you could use this:


$dir_handle = opendir("$pwd");

$f = 1; $d = 1

for ($x = 1; $x < 900; $x++) {
$element = readdir($dir_handle);
if (($element) && ($element != ".") && ($element != "..") {
if (is_dir("$pwd/$element")) {
$dirs[$d] = $element;
$d++;
} else if (strpos("$element", ".htm") !== false) {
$files[$f] = array("name" => "$element", "title");
$tmpcontent = file_get_contents("$pwd/$element");
$tmptitle = substr($tmpcontent, stripos($tmpcontent, "<title>"), stripos($tmpcontent, "</title>"));
if ($tmptitle == "") $tmptitle = $element;
$files[$f][title] = $tmptitle;
unset($tmptitle, $tmpcontent);
$f++;
}
}
}

if (sizeof($dirs) > 0) {
sort($dirs);
reset($dirs);
}

if (sizeof($files) > 0) {
sort($files);
reset($files);
}


To be continued.