Shoutbox

including entire folders with php - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: including entire folders with php (/showthread.php?tid=63036)

including entire folders with php by stoshrocket on 07-11-2006 at 12:01 PM

is it possible to include entire folders using php... so if i had index.php and i wanted to include all the files in the firectory http://url/php/ would i be able to do so? or is it only possible to only include seperate files?? Thanks


RE: including entire folders with php by Veggie on 07-11-2006 at 12:09 PM

use your head, get all the files in the dir then loop through them:

PHP 5
http://uk.php.net/manual/en/function.scandir.php


RE: including entire folders with php by stoshrocket on 07-11-2006 at 12:22 PM

quote:
Originally posted by Veggie
use your head, get all the files in the dir then loop through them:

PHP 5
http://uk.php.net/manual/en/function.scandir.php

oh cool, awesome, sorry, i've only just started to learn php... thanks :happy:
RE: including entire folders with php by ShawnZ on 07-11-2006 at 12:23 PM

insecurity alert...


RE: including entire folders with php by -dt- on 07-11-2006 at 12:25 PM

quote:
Originally posted by Veggie
use your head, get all the files in the dir then loop through them:

PHP 5
http://uk.php.net/manual/en/function.scandir.php
pfft directory iterators \o/

code:
foreach($dir = new DirectoryIterator("./includes") as $file){
if($dir->isFile() && strrchr($file, ".") == ".php")include($dir->getPathname());
}



RE: including entire folders with php by stoshrocket on 07-11-2006 at 01:07 PM

quote:
Originally posted by ShawnZ
insecurity alert...
eh?
quote:
Originally posted by -dt-
pfft directory iterators \o/
:S
*looks up directory iterators*