wkdw1ll1ams Posted August 27, 2011 Author Share Posted August 27, 2011 you mean if(is_dir($dir.'/films'.$file)) { $contents[$dir.'/films'.$file] = dirContents($dir.'/films'.$file); } else { $contents[] = $dir . '/films' . $file; Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262515 Share on other sites More sharing options...
WebStyles Posted August 27, 2011 Share Posted August 27, 2011 yes, what is wrong with this? if(is_dir($dir.'/films'.$file)) { Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262516 Share on other sites More sharing options...
wkdw1ll1ams Posted August 27, 2011 Author Share Posted August 27, 2011 theres no film folder name? Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262518 Share on other sites More sharing options...
WebStyles Posted August 27, 2011 Share Posted August 27, 2011 id_dir() expects a path. what you're 'feeding' it is not a valid path, so the if statement will always fail. Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262519 Share on other sites More sharing options...
wkdw1ll1ams Posted August 27, 2011 Author Share Posted August 27, 2011 if(is_dir($dir.'/films/scream4/scream4.avi'.$file)) { Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262520 Share on other sites More sharing options...
WebStyles Posted August 27, 2011 Share Posted August 27, 2011 Nope! Close, but wrong. Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262521 Share on other sites More sharing options...
wkdw1ll1ams Posted August 27, 2011 Author Share Posted August 27, 2011 films/scream4/ ? Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262522 Share on other sites More sharing options...
WebStyles Posted August 27, 2011 Share Posted August 27, 2011 don't type the path, type the code needed! Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262523 Share on other sites More sharing options...
wkdw1ll1ams Posted August 27, 2011 Author Share Posted August 27, 2011 if(is_dir($dir.'/films/scream4'.$file)) { ? Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262524 Share on other sites More sharing options...
WebStyles Posted August 27, 2011 Share Posted August 27, 2011 wrong... how come you were *thinking* about this properly when it was my code, but not with yours? Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262525 Share on other sites More sharing options...
wkdw1ll1ams Posted August 27, 2011 Author Share Posted August 27, 2011 your code was using "echo" and i understand that, but my code is different. Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262526 Share on other sites More sharing options...
WebStyles Posted August 27, 2011 Share Posted August 27, 2011 it's the same thing... imagine everything inside the () is an echo. Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262527 Share on other sites More sharing options...
jcbones Posted August 27, 2011 Share Posted August 27, 2011 Run this: <?php function dirContents($dir) { if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(in_array($file,array('.','..'))) { continue; } if(is_dir($dir.'/'.$file)) { $contents[$dir.'/'.$file] = dirContents($dir.'/'.$file); } else { $contents[] = $dir . '/' . $file; } } closedir($dh); } } return $contents; } function processArray($array) { if(is_array($array)) { echo '<ol>'; foreach($array as $key => $value) { if(is_int($key)) { echo '<li><a href="'.$value.'">'.str_replace('/','',strstr(strrchr($value,'/'),'.',true)).'</a></li>'; } else { echo '<li><span style="font-weight:bold">' . $key . '</span>'; processArray($value); echo '</li>'; } } echo '</ol>'; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" /> <meta name="author" content="FilmZilla"> <meta name="publisher" content="FilmZilla"> <meta name="copyright" content="FilmZilla"> <style type="text/css"> @import url(styles.css); </style> <title>FilmZilla</title> </head> <body> <div id="header">FilmZilla</div> <div id="bar_nav"> <ul> <a href="#">Home</a> <a href="Donate.html">Donate</a> </ul> </div> <div id="content_left"> <h1>Newest Films</h1> Planet 51 <BR> Scream 4 <BR> Xmen First Class </div> <!-- this is where the film links are ################################################## --> <div id="content"><h1>Films</h1> <?php $dir = 'films'; $files = dirContents($dir); processArray($files); ?> <!--this is where the film links end ################################################## --> </div> <div id="bar_bottom2"><marquee>Films are all DVDRIP. Please donate. Do not take credit for these movies!</marquee></div> <div id="bar_bottom">© 2011 | Copyright © FileZilla</a></div> <!--[if IE]></div><![endif]--> <div style="text-align: center; font-size: 0.75em;">Copyright© FilmZilla</a>.</div></body> <link rel="shortcut icon" href="icon.ico"> <link rel="icon" type="image/gif" href="icon.png"> </html> Don't change anything, but put this script in the directory that HOLDS the 'films' folder! NOT in the 'films' folder. Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262528 Share on other sites More sharing options...
wkdw1ll1ams Posted August 27, 2011 Author Share Posted August 27, 2011 oh i see silly me special thanks to WebStyles for the lesson Link to comment https://forums.phpfreaks.com/topic/245688-help-with-this-code-please/page/3/#findComment-1262529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.