I have this code:
$path = "./wp-content/uploads/webvideos/";
$webdir = site_url()."/wp-content/uploads/webvideos/";
$post_title = html_entity_decode(get_the_title());
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS));
$files = array();
$notAllowedExtension = array('jpg', 'mp3', 'vtr', 'html', 'htm' );
foreach($iterator as $file){
if(!in_array($file->getExtension(), $notAllowedExtension) && !$file->isDir())
$files[] = $file->getFilename();
}
ksort($files);
foreach($files as $value){
Echo $value . "<br>";
}
if( $autoplay > count( $files ) ) $autoplay = 1;
if( $autoplay > 0 ) $autoplay = $autoplay -1;
foreach($files as $file => $date){
if( $i==$autoplay ) $file_main = $file;
$output .= "" . PHP_EOL .
"<tr>
<td><a href=\"javascript:loadVideo('$webdir$file.mp4')\"> $file - (Click Me)</a>
</td>
<td>NA</td>
</tr>"
. PHP_EOL;
$i++;
}
I have added more of the code. Now I have an issue because the echo works but not the rest of the code.
However, the output is:
[1350528689] => V001 - Test Video.mp4
[1350568321] => V001-Test-Video.mp4
[1430061765] => V001-My-First-Video.mp4
But I need it to be like this:
V001 - Test Video.mp4
V001-Test-Video.mp4
V001-My-First-Video.mp4
I have spent hours looking for a solution, but not joy.