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

i guess this is a really simple problem, but i just can't get it
Guess this is a pretty simple problem. I've got a regex and php that
I guess, the following is a standard problem on every school or university: It
I guess I don't give title nicely, anyways, I can explain it better here:
I guess you could classify this as a Scrabble style problem, but it started
I guess it's a simple question, but how can I replace nil values in
I guess an example of jaas.conf file that uses the NTLoginModule for authentication would
I guess that this is a really stupid question, knowing that .net-code can be
I guess I've seen it somewhere before, but now I can't remember nor find
I guess I can chnage pattern by adding the line java.util.logging.ConsoleHandler.pattern, however where to

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.