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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:56:27+00:00 2026-05-24T04:56:27+00:00

I guess I’m having trouble mushing the scripts together. I can print the file

  • 0

I guess I’m having trouble mushing the scripts together. I can print the file names of the content in the folder, no problem. I’ve got the slideshow working when img urls are listed directed into the div. NOW I need to get the file name, and echo a …. somehow.

          <script type="text/javascript">

      function slideSwitch() {
          var $active = $('#slideshow DIV.active');

          if ( $active.length == 0 ) $active = $('#slideshow DIV:last');

          // use this to pull the divs in the order they appear in the markup
          var $next =  $active.next().length ? $active.next()
              : $('#slideshow DIV:first');

          // uncomment below to pull the divs randomly
          // var $sibs  = $active.siblings();
          // var rndNum = Math.floor(Math.random() * $sibs.length );
          // var $next  = $( $sibs[ rndNum ] );


          $active.addClass('last-active');

          $next.css({opacity: 0.0})
              .addClass('active')
              .animate({opacity: 1.0}, 1000, function() {
                  $active.removeClass('active last-active');
              });
      }

      $(function() {
          setInterval( "slideSwitch()", 5000 );
      });

      </script>


       <div id="slideshow">
       <?php
      $dir = "images/featured/";
      $dh = opendir($dir);
      while (($file = readdir($dh)) !== false) {
      echo "";
      }
      closedir($dh);
      ?>
      </div>
  • 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-24T04:56:27+00:00Added an answer on May 24, 2026 at 4:56 am

    It looks like you’re confusing your JS and PHP as far as which does what. PHP is server-side while JS is client side (for your case). Once the content reaches the browser, PHP’s job is done and JS’s begins.

    Your PHP code outputs nothing at all. Here’s how it’s being executed

    1. You open the directory
    2. Read the filenames one at a time
    3. Echo an empty string

    If you want to pass data from PHP to JS, you need to do something like

    var phpData = <?php echo $dataIWantToAccessInJs; ?>;
    

    Finally, you don’t need to prefix your regular JS variables with the $ sign. It is required in PHP though, but keeping the $ for PHP (and jQuery objects) will cut down on the aforementioned confusion between JS and PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guess this is a pretty simple problem. I've got a regex and php that
I guess the problem is that I do not know how to use factory
I guess this question has been asked a lot around. I know Rails can
#Guess the number game by Johnathan Millsap import random guessesTaken = 0 print('Hello! What
My guess is it just made parsing easier, but I can't see exactly why.
I guess this problem is really about performance, but I'm trying to get a
I guess this is a python path problem (on FreeBSD 8.1). Im trying to
I guess I am missing something quite fundamental and maybe someone can fill me
I guess it's a simple Data Binding issue but I can't make it work.
I guess this problem is common for CoffeScript and JavaScript. In my CoffeeScript script

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.