PHP's scandir with ajax call

I have some content loaded via ajax that includes the scandir() function. On local and on my server it works perfectly, however on my client's server it didn't work because they run PHP4 (scandir() was implemented in version 5). I called tech support and their solution was to change file extensions from .php to .php5. However, this only partially works if I call directly the page, but when I load it via ajax it does not.

Is there a way to fix this? I didn't know ajax and PHP could be incompatible.

EDIT

Here's part of the code. Is simply an image gallery and I'm using scandir() to get the images:

<div id="#vtabs-content-a">
    <ul class="slider">
        <?php
            $featured_dir = 'img/systems/6020/';
            $scan = scandir($featured_dir);
            echo '<li id="' . $scan[2] . '"><img src="' . $featured_dir . $scan[2] . '" alt="' . $scan[2] . '" width="700" height="350" /></li>';
        ?>
    </ul>
    <ul class="thumb 6020a">
        <?php
            $dir = 'img/systems/6020/z_thumbs/';
            $scan = scandir($dir);  
            for ($i = 0; $i<count($scan); $i++) {
                if ($scan[$i] != '.' && $scan[$i] != '..') {
                echo '<li><a href="#' . $featured_dir . $scan[$i] . '"><img src="' . $dir . $scan[$i] . '" alt="' . $scan[$i] . '" width="40" height="40" /></a></li>';
                }
            }; 
        ?>
    </ul>

I actually had forgotten to change to .php5 in the ajax call, already did it but still won't work. Another point is that when I call the page directly the slideshow doesn't work, but at least the pictures are there.

The ajax call is this:

$(".a6020").live("click", function(){
    $("#main").load("a6020.php5 #container", function(){
        $('#vtabs5').jVertTabs();
        $.getScript("js/scandir.js", function(){
        });
    });
});

Answers


You could try adding a .htaccess file to run php5 on extensions that end in .php by adding

AddHandler application/x-httpd-php5 .php 

To a .htaccess file.


Need Your Help

How do I render a single tweet in a webpage?

jquery twitter

I am trying to include a rendered tweet in a webpage. I searched around and eventually got myself this solution:

Is Phalcon UTF8 compliant?

php utf-8 phalcon

I was wondering what is the internals of Phalcon using with regards to UTF8?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.