Results 1 to 2 of 2

Thread: How to maintain links to files efficiently?

  1. #1
    Join Date
    Mar 2007
    Posts
    1

    How to maintain links to files efficiently?

    Hi, I made a webpage with links that linked to over hundreds of PDF files. At first I make each PDF a link on my page but now I feel it's a bad idea when comes to updating modified or new PDF file. What kind of method should I use to maintain the updates efficiently?

    Thx in advance..

  2. #2
    Join Date
    Jan 2006
    Location
    Michigan
    Posts
    394
    Make a php script to have it list all the .pdf files in your pdf directory. That way you won't have to worry about it not being up to date. All it takes is something like this:
    PHP Code:
    <?php
    $pdfs 
    scandir('pdf/directory/');
    foreach (
    $pdfs as $v)
      {
      if ((
    stripos($v,'.pdf') !== false) && (strpos($v,'.') !== 0))
        {
        echo 
    '<a href="pdf/directory'.$v.'">'.$v."</a>\n";
        }
      }
    //Unless server is still on PHP 4, then things get more complicated as you'll have to make your own scandir function and will have to use strpos instead of stripos.  Use phpinfo() to determine server information (unless that has been disabled too).
    ?>
    Co-founder Aedis IT www.aedisit.com
    Registered Linux User #445070 counter.li.org
    Zend Certified Engineer - CIW Professional - CompTIA Linux+ - CompTIA Network+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •