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 7524317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:04:06+00:00 2026-05-30T03:04:06+00:00

I have slightly simplified the default index.php file supplied with WAMP, so that it

  • 0

I have slightly simplified the default index.php file supplied with WAMP, so that it works from any directory/location.

The problem I have is that the order is grouping capitals together.

Eg a, b, c, A, B, C

When I want: A, a, B, b, C, c

<?php
date_default_timezone_set('Europe/London');
$title = 'Project Directory';
$server = 'http://' . $_SERVER['SERVER_NAME'];
$date = date('Y');

//Directory / Files
$dir    = '.';
$files = scandir($dir);

$projectsListIgnore = array ('RemoteSystemsTempFiles','icons');
$projectsFileListIgnore = array ('.project');

$projectContents = '';
$projectFileContents = '';

foreach ($files as $file) {

    if (is_dir($file) && !in_array($file,$projectsListIgnore) && substr($file,0,1) != '_' && substr($file,0,1) != '.')  {       

        $projectContents .= '<li><a class="arrow external" href="'.$file.'">'.$file.'</a></li>';

    } 

    if (is_file($file) && !in_array($file,$projectsFileListIgnore) && substr($file,0,1) != '_' && substr($file,0,1) != '.') {
        $projectFileContents .= '<li><a class="arrow icon iicon external" href="'.$file.'"><em class="ii-download '. pathinfo($file, PATHINFO_EXTENSION) .'"></em>'.$file.'</a></li>';
    } 
}


$pageContents = <<< EOPAGE
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html lang="en" xml:lang="en">
<head>
    <title>{$title}</title>
    <meta http-equiv="Content-Type" content="txt/html; charset=utf-8" />
    <link href="icons/favicon.ico" rel="icon" type="image/x-icon" />

    <style type="text/css">
    * {
        margin: 0;
        padding: 0;
    }

    html {
        background: #ddd;
    }
    body {
        margin: 1em 10%;
        padding: 1em 3em;
        font: 70%/1.4 arial, helvetica, lucida sans, sans-serif;
        border: 1px solid #999;
        background: #eee;
        position: relative;
    }
    #head {
        margin-bottom: 1.8em;
        margin-top: 1.8em;
        padding-bottom: 0em;
        border-bottom: 1px solid #999;
        letter-spacing: -500em;
        text-indent: -500em;
        height: 125px;
    }
    h2 {
        margin: 0.8em 0 0 0;
    }
    ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    ul.projects, ul.tools, ul.files {
        list-style: none;
        line-height: 24px;
    }
    ul.aliases a, ul.projects a, ul.tools a {
        display: block;
        padding: 1px 0 2px 25px;
        background: url(/icons/folder.png) 0 0 no-repeat;
    }
    ul.files a {
        display: block;
        padding: 1px 0 2px 25px;
        background: url(/icons/generic.png) 0 0 no-repeat;
    }
    ul.aliases a {
        background: url(/icons/forward.png) 0 0 no-repeat;
    }
    dl {
        margin: 0;
        padding: 0;
    }
    dt {
        font-weight: bold;
        text-align: right;
        width: 11em;
        clear: both;
    }
    dd {
        margin: -1.35em 0 0 12em;
        padding-bottom: 0.4em;
        overflow: auto;
    }
    dd ul li {
        float: left;
        display: block;
        width: 16.5%;
        margin: 0;
        padding: 0 0 0 20px;
        background: url(/icons/pngPlugin.png) 2px 50% no-repeat;
        line-height: 1.6;
    }
    a {
        color: #024378;
        font-weight: bold;
        text-decoration: none;
    }
    a:hover {
        color: #04569A;
        text-decoration: underline;
    }
    #foot {
        text-align: center;
        margin-top: 1.8em;
        border-top: 1px solid #999;
        padding-top: 1em;
        font-size: 0.85em;
    }
    </style>

</head>

<body>
    <div style="margin: 15px 0 0 0; border-bottom:1px solid #999999;">
    <h2>Directory Idex</h2>
    </div>
    <div style="width:50%; float: left; padding: 0 0 15px 10px;">
        <h2>Projects</h2>
        <ul class="projects">
        $projectContents
        </ul>
    </div>
    <div style="width:40%; float: left; padding: 0 10px 15px 10px;">
    <h2>Links</h2>
    <ul class="tools">
        <li class="php"><a href="?phpinfo=1">phpinfo()</a></li>
        <li class="phpmyadmin"><a href="/phpmyadmin/">phpMyAdmin</a></li>
    </ul>
    <h2>Files</h2>
    <ul class="files">
    $projectFileContents            
    </ul>
    </div>
    <ul style="clear: both;" id="foot">
        <li>&copy; Copyright $date</li>
    </ul>
</body>
</html>
EOPAGE;

echo $pageContents;
?>
  • 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-30T03:04:09+00:00Added an answer on May 30, 2026 at 3:04 am

    Try natcasesort (manual) on the $files array before the foreach loop.

    Example:

    $files = scandir($dir);
    natcasesort($files);
    foreach ($files as $file) {
        // do stuff
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGrid that looks like this (slightly simplified here): <asp:DataGrid ID=grdQuotas runat=server
I have to interface with a slightly archaic system that doesn't use webservices. In
I have a menu bar that is rotated slightly. Here are two buttons as
I have a list of addresses in two separate tables that are slightly off
I have an NSIS based installer that I need to be able generate slightly
I have 2 elements that both need to be dragged. The simplified markup is
I have three modules in my Maven project (this is slightly simplified): model contains
I have the following schema, which I've simplified slightly: CREATE TABLE [dbo].[Header] ( [HeaderId]
I have a slightly odd problem that I think is most likely due to
I have a bash function (slightly simplified for explaining) copy_to() { cp $1 $2

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.