Jump to content

bungee

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bungee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. How about the function http://us.php.net/manual/en/function.substr.php It is what I used to do the same thing. I am new to php but from what I gather, you tell it where to start and how much to keep. If the length changes often then you could just use the size of the variable to tell it to keep all but the last letter. I have no clue as to how efficient it is though. I should have read it first. $rest = substr("abcdef", 0, -1); // returns "abcde"
  2. Let me start by saying that I know very little about php but I know enough that I like to tinker. I have made a small website to be used locally only at my job to make sorting and finding bookmarks more efficiently. We also have a catalog of pdf files for looking up various stuff that currently are a pain. I finally got some code going that lists them all with their url. There are some directories that are giving me fits though. It seems that it doesn't like the file names of some of the files and instead lists names that aren't there, along with some that are. I have found that some of the 'made up' names are actually in the title. An example. In the directory c:/xampp/htdocs/site/diagrams/mantis there is a file called 7222 sv4b1le.pdf with a title of 400730.TILLER. On the page it shows a file named 400730.pdf which doesn't exist and doesn't show the 7222 sv4b1le.pdf file in the list.;Does php hate pdf files? Am I doing something wrong? Please help. Here is the code. I left it pretty basic until I get it to do what I want. <?php function scandir_recursive($dir) { $items = scandir($dir); foreach($items as $item) { if ($item == '.' || $item == '..') { continue; } $tfile = $dir . '/' . $item; $fname = $item; if (is_dir($item)) { echo "<h1>$item</h1>"; } else if (is_dir($tfile)) { echo "<h1>$item</h1>"; } else { $tfile2 = substr($tfile, 7); echo "<a href='$tfile2'>$fname</a>------http://127.0.0.1$tfile2<br />"; } if (is_dir($tfile)) { scandir_recursive($tfile); } } } scandir_recursive('/htdocs/site'); //scandir_recursive('/htdocs/site/diagrams/mantis'); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.