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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:02:32+00:00 2026-06-15T05:02:32+00:00

I have a what seems like simple issue. I would like to have my

  • 0

I have a what seems like simple issue. I would like to have my playlists auto populated with the files in a folder. So as mp3s are added to the folder the files are generated in the playlist.
I can display all the files in a folder and have the file names outputted on there own line using:

<?php
$dir = "app/vd/$val/";
$files = scandir($dir);
foreach ($files as &$file) {
    if ($file!='.' && $file!='..' )
    {
        echo $file.'<br>';
    }
}
?>

And I manually add files to the play list using:

<ul id="playlist" style="margin-left:auto; margin-right:auto;">
<li mp3="app/vd/<?php echo $val ?>/whatever.mp3" ogg="app/vd/<?php echo $val ?>/whatever.ogg" artist="<?php echo $val ?>" title="<?php echo $val1 ?>" ></li>

<li mp3="app/vd/<?php echo $val ?>/whatever2.mp3" ogg="app/vd/<?php echo $val ?>/whatever2.ogg" artist="<?php echo $val ?>" title="<?php echo $val1 ?>" ></li> 

Any help would be greatly appreciated.

  • 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-15T05:02:33+00:00Added an answer on June 15, 2026 at 5:02 am

    Just put it between the ul tags …

    <ul id="playlist" style="margin-left:auto; margin-right:auto;">
        <?php
        $dir = "app/vd/$val/";
        $files = scandir( $dir );
        foreach ( $files as $file )
            if ( $file != '.' && $file != '..' )
                echo '<li mp3="app/vd/', $val, '/', $file,'" ogg="app/vd/', $val, '/', $file, '" artist="', $val, '" title="', $val1, '" ></li>';
        ?>
    </ul>
    

    or to make it look nicer

    <?php $files = scandir( "app/vd/$val/" ); ?>
    <ul id="playlist" style="margin-left:auto; margin-right:auto;">  
        <?php foreach ( $files as $file )
            if ( $file != '.' && $file != '..' )
                echo "<li mp3=\"app/vd/$val/$file\" ogg=\"app/vd/$val/$file\" artist=\"$val\" title=\"$val1\" ></li>"; ?>
    </ul>
    

    P.S.: glob is a neat little function http://de3.php.net/manual/en/function.glob.php
    P.P.S: iterators on directories are neat, too

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

Sidebar

Related Questions

This seems like an incredibly simple issue but I have no idea why I'm
I have what seems like a simple arrangement: a list of tags in a
I have what seems like a simple problem. I have a Spring web app,
This seems like a simple problem: I have a WF4 activity that guides the
This seems like such a simple question. I have several Edit boxes on my
This seems like it should be so simple, but apparently it isn't. I have
I have an issue that seems like very flaky behavour, is this a problem
This seems like a fairly simple issue, however I could not find any straight
I have what seems to be a simple issue, but of course it never
It seems like I have begin ... rescue ... end statements everywhere in my

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.