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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:06:32+00:00 2026-06-04T07:06:32+00:00

I am trying to make an HTML5 slideshow system that implements PHP. My idea

  • 0

I am trying to make an HTML5 slideshow system that implements PHP. My idea begins with making a system that detects the images in a folder, and puts them in an array, which the jquery will then be able to access for implementation in the slideshow. Firstly I have a php file that will detect the names of every file in the folder, and output them as plain text.

How, instead of outputting as plain text, can i make the PHP transfer the file names to a numerical array, which can be used with the jquery that will then accompany it?

I intend to use jquery to access the numerical array that is then made. How is this done? Unless it is not possible to do, and so how else can it be done?

The goal is to be able to put files in a folder, and for the scripting to dynamically recognize the presence of files, and incorporate them in a slideshow. This slideshow will then be output to a screen display which will be used in a waiting area, showcasing our school with a slideshow of images about the school.

Here is the code that I have so far:

<?php
    //Open images directory
    $dir = opendir("images");
    //List files in images directory
    while (($file = readdir($dir)) !== false)
    {
        echo "filename: " . $file . "<br />";
    }
    closedir($dir);
?>

At this point I do not know how to make PHP “talk” with Javascript. I hope that there is some simple method for this, what I think I’m going for is AJAX, but I have no idea how this works.

  • 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-06-04T07:06:33+00:00Added an answer on June 4, 2026 at 7:06 am

    The answer here is to use JSON, a subset of Javascript supported by many languages that allows you to (amongst many other things) very easily pass structured data into Javascript from external sources. PHP has a function json_encode() which allows you convert PHP data structures – usually arrays or objects – into a format the Javascript can easily read. jQuery also has built-in support for JSON.

    <?php
    
        // An array of the image file names
        $images = array();
    
        //Open images directory
        $dir = opendir("images");
    
        //List files in images directory
        while (($file = readdir($dir)) !== false)
        {
            $images[] = $file;
        }
        closedir($dir);
    
        echo json_encode($images);
    
    ?>
    

    Now, in jQuery you can do this:

    $.getJSON('http://url/of/your/script.php', function(images) {
      // In here the variable "images" is an array identical to the one you constructed with PHP
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to make a script that compares two images in HTML5
I’m trying to make a html5 form that contains one email input, one check
I'm trying to make a HTML5 webapp that simply plays a sound over and
I'm trying to make an HTML5-based notification system, based on when something occurs on
I'm trying to make a javascript slideshow that has a forward and back button.
I am trying to make a plugin for displayng html5 video as follows: (function
I am trying to make an iPhone application for mobile health using HTML5, JavaScript,
Newbie question. I'm trying to make a mobile site using html5's geolocation (I know
I'm trying to make a web app that will read in a server-side CSV
I am trying to make a website.The Compulsion is that it should work on

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.