Jump to content

sponji

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sponji's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Something like this then? <?php $url = 'http://192.168.0.5/motion/'; $files = glob('*.flv'); $files = array_filter($files, 'is_file'); $video = 'video/flv'; $poster = 'uebere.png'; $title = 'Movies'; $logo = "logo.png"; $count = count($files); for($i = 0; $i < $count; $i++) { $playlist[] = array( array( 'src' => $url.$files[$i] , 'type' => $video ), 'config' => array( 'title' => $title, 'poster' => $logo) ); } echo json_encode($playlist); ?> This doesn't work. Even putting the json line inside the for loop, returns nothing.
  2. <?php $url = 'http://192.168.0.5/motion/'; $files = glob('*.flv'); $files = array_filter($files, 'is_file'); $video = 'video/flv'; $poster = 'uebere.png'; $title = 'Movies'; $logo = "logo.png"; $playlist = array( '0' => array( '0' => array( 'src' => "$url$files[0]", 'type' => "$video", ), 'config' => array( 'title' => "$title", 'poster' => "$logo") ), ); for ($i=0; $i < 3; $i++) { $playlist[$i]['src'] = "$url$files[$i]"; $playlist[$i]['type'] = "$video"; $playlist[$i]['title'] = "$title"; $playlist[$i]['poster'] = "$logo"; } echo json_encode($playlist); ?> I cannot seem to figure out how to add before every Making the output look like this and not like this
  3. Thanks for your reply silkfire. I took your advise and am gaining ground now. <? $url = 'http://192.168.0.5/motion/'; $files = glob('*.flv'); $files = array_filter($files, 'is_file'); $playlist = array( '0' => array( '0' => array( 'src' => "$url$files[1]", 'type' => 'video/flv', ), 'config' => array( 'title' => "Movies", 'poster' => 'uebere.png') ), ); for ($i=0; $i < 10; $i++) { $playlist[$i]['src'] = "$url$files[$i]"; } echo json_encode($playlist); ?> I have an output like this now.. [{"0":{"src":"http:\/\/192.168.0.5\/motion\/37-20110729210403.flv","type":"video\/flv"},"config":{"title":"Movies","poster":"uebere.png"},"src":"http:\/\/192.168.0.5\/motion\/36-20110729205848.flv"},{"src":"http:\/\/192.168.0.5\/motion\/37-20110729210403.flv"},{"src":"http:\/\/192.168.0.5\/motion\/38-20110730054357.flv"},{"src":"http:\/\/192.168.0.5\/motion\/39-20110730055121.flv"},{"src":"http:\/\/192.168.0.5\/motion\/40-20110730055815.flv"},{"src":"http:\/\/192.168.0.5\/motion\/41-20110730060257.flv"},{"src":"http:\/\/192.168.0.5\/motion\/42-20110730060802.flv"},{"src":"http:\/\/192.168.0.5\/motion\/43-20110730061421.flv"},{"src":"http:\/\/192.168.0.5\/motion\/44-20110730062055.flv"},{"src":"http:\/\/192.168.0.5\/motion\/45-20110730062633.flv"}] I am just missing the "0": before eacho {"src": line. Any help? Thanks
  4. I was REALLY tired when I wrote that first post. Here is my 2nd attempt. (Just woke up off 20 hours of staring at php) Bare with me. Say I have a directory with 3 files "movie1.flv" "movie2.flv" "movie3.flv" The output I am going for is. [{"0":{"src":"http:\/\/192.168.0.5\/motion\/movie.flv","type":"video\/flv"},"config":{"title":"Movies","poster":"uebere.png"}},{"0":{"src":"http:\/\/192.168.0.5\/motion\/movie2.flv","type":"video\/flv"},"config":{"title":"Movies"}},{"0":{"src":"http:\/\/192.168.0.5\/motion\/movie3.flv"},"type":"video\/flv"},"config":{"title":"Movies","poster":"intro.png"}}] How do I write these url's into a undefined variable in an array? <?php $dir = './motion'; $url = 'http://192.168.0.5/motion/'; $playlist = array( '0' => array( '0' => array( 'src' => "$url$file", 'type' => 'video/flv', ), 'config' => array( 'title' => "Movies", 'poster' => 'uebere.png') ), ); //$playlist = array(); if (is_dir($dir)) { $dp = opendir($dir); while (false !== ($file = readdir($dp))){ if ('flv'==strtolower(substr($file, -3))) { $playlist[] = "$url$file"; } } closedir($dp); } echo json_encode($playlist); ?>
  5. I am really new to PHP, but I have to agreee. I have had problems logging in to admin panels, because of validating the IP when my IP changes randomly per clicks on websites (This is a common for satellite dish ISP users) it logs me out, for instances PHPBB forums.. By default it validates the IP by default.
  6. I'm trying to make a playlist output from a directory of movie clips. Here is what I have came up with so far. <?php $dir = './motion'; $url = 'http://192.168.0.5/motion/'; $playlist = array( 0 => array( 0 => array( 'src' => $url$file, 'type' => 'video/flv', ), 'config' => array( 'title' => "Movies", 'poster' => 'uebere.png') ), ); //$playlist = array(); if (is_dir($dir)) { $dp = opendir($dir); while (false !== ($file = readdir($dp))){ if ('flv'==strtolower(substr($file, -3))) { $playlist[] = $url$file; } } closedir($dp); } echo json_encode($playlist); ?> I need it to display an output like this. [{"src":"http:\/\/192.168.0.5\/motion\/36-20110729205848.flv","type":"video\/flv","title":"Movies","poster":"uebere.png"},{"src":"http:\/\/192.168.0.5\/motion\/37-20110729210403.flv","type":"video\/flv","title":"Movies","poster":"uebere.png"}]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.