how can / do you make a php script that will include all the files in a file like (names/) without you having to specify include "names/1.php" etc?
how can / do you make a php script that will include all the files in a file like (names/) without you having to specify include "names/1.php" etc?
PHP Code:<?php
$file = file('text.txt');
foreach ($file as $inc) {
include $inc;
}
?>
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Code:$d = opendir('names/'); while($f = readdir($d)) if(strlen($f) - strrpos($f, '.inc.php') === 8) include $f; closedir($d);
Last edited by Twey; 07-26-2007 at 07:41 AM.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Yes, it would.
And... yeah... I missed that "file" in this case meant "directory"![]()
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Aye, sorry -- edited.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks