PDA

View Full Version : Need to index orphan php pages, how?


hotmonkey
07-30-2004, 11:11 PM
I have a directory or two that contain no index.php page within them or pages that contain any links to the pages in that directory. They are just directories that contain specific php pages full of content. A general example would be;
DIR cars/
ford.php
chevy.php
toyota.php
no links to them (or in them) and no index in directory.

(actual example
(ROOT...)/archive/20040313.php
(ROOT...)/gallery/trout.php or 20040415_stills.php
if this may offer an idea or clue)

Is there some other answer than "sorrrrry duuuude, make an index that lists them....." (there are several hundred and they change from time to time), and listing them one at a time is not pratical at the moment.

There are other indexers that seem to do this, however I would like to stick with digphp as the results seem better (nicer) once I got the hang of setting the default search to "or", tweeking a template and along with other helpful hints from this forum.

Any suggestions or ideas will be welcome, or places to look. I am a bit remedial at the moment concerning phpdig but learning and would prefer to not have to change to another indexer/search if I could help it. Thank you!

Charter
07-31-2004, 12:48 AM
Hi. PhpDig follows links so just make a list, but don't hand-type the list...

<?php
// link to files modified within the hour in current directory
$base = basename($_SERVER['PHP_SELF']);
if ($handle = opendir(".")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != $base) {
if (filemtime($file) > time() - 3600) {
echo "<a href=\"$file\">$file</a><br>";
}
}
}
closedir($handle);
}
?>

hotmonkey
07-31-2004, 07:10 AM
I think the "Head Mole" title suits you well today. A wonderful and easy work around to my need.

Did need to try twice after a moment of staring:
ORIG: if (filemtime($file) > time() - 3600) {
Changed to "<" and found all the files.

Thank you for sharing your knowledge.

Followup Question:
Once the files are in the index database, can I remove this page and trust that the "/admin/update-functions" will find them again or do I have to leave this page in the directory for future updates on existing pages?

Again, Thanks!

Charter
07-31-2004, 10:41 AM
You can use the update button from the admin panel to remove the list page from PhpDig and update portions of a site. If you add new pages that are not linked, just use the list script with ">" and maybe change 3600 to X so that the files listed are those that were modified within the last X seconds.