Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6534681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:16:47+00:00 2026-05-25T10:16:47+00:00

I cannot seem to get the links that are populated from the directory scan

  • 0

I cannot seem to get the links that are populated from the directory scan to LINK up appropriately. When I click the populated link it is currently referencing the current directory instead of the grandchild directory here dir_2/dir_3. Any help would be very appreciated.

 <?php

  // These files will be ignored
  $excludedFiles = array (
'excludeMe.file',
'excludeMeAs.well'
);

// These file extensions will be ignored
$excludedExtensions = array (
  'html',
'xslt',
'htm',
'ahk',
'xsl',
'txt',
'xml'
);

// Make sure we ignore . and ..
$excludedFiles = array_merge($excludedFiles,array('.','..')); 

 // Convert to lower case so we are not case-sensitive
 for ($i = 0; isset($excludedFiles[$i]); $i++) $excludedFiles[$i] =        
 strtolower(ltrim($excludedFiles[$i],'.'));
  for ($i = 0; isset($excludedExtensions[$i]); $i++) $excludedExtensions[$i] =    
 strtolower($excludedExtensions[$i]);

  // Loop through directory
  $count = 0;
  if ($handle = opendir('dir_2/dir_3')) {
  while (false !== ($file = readdir($handle))) {
  $extn = explode('.',$file);
  $extn = array_pop($extn);
  // Only echo links for files that don't match our rules
  if (!in_array(strtolower($file),$excludedFiles) &&   
  !in_array(strtolower($extn),$excludedExtensions)) {
    $count++;
    print("<a href=\"".$file."\">".$file."</a><br />\n");
  }
}
echo '<br /><br /><a href="..">Return</a>';
closedir($handle);
}

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:16:48+00:00Added an answer on May 25, 2026 at 10:16 am

    You need to append the directory you’re looking at to the link.

    $dir = 'dir_2/dir_3';
    if ($handle = opendir($dir)) {
    // snip
    print("<a href=\"".$dir.$file."\">".$file."</a><br />\n");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot seem to get this date picker working at all. I know it
I cannot seem to get the quotes around this statement right. No matter what
For some reason I cannot seem to get a ko.computed observable to compute when
I have this design which I cannot seem to get right, I would like
I recently started with PHP Object Oriented and I cannot seem to get this
I need a function, but cannot seem to get it quite right, I have
I'm terribly new to SQL, and cannot seem to get the desired information out,
This is a very old problem, but I cannot seem to get my head
So obviously I am doing something wrong, but I just cannot seem to get
I'm having trouble with my DatabaseConnection class. I cannot seem to get $dbUser or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.