Welcome Guest, Not a member yet? Register   Sign In
Directory Helper Question
#6

(02-04-2016, 03:34 AM)InsiteFX Wrote: Try casting $image ie; (string) $image etc;

Seem to  have it working now by using scandir and array_diff

PHP Code:
<?php

class Filemanager extends CI_Controller {

    public function 
index() {

        
$this->load->helper('directory');

        
$data['images'] = array();

        
$directory scandir(FCPATH 'images/catalog'1);

        
$files array_diff($directory, array('.''..'));

 
       var_dump($files);

     
   foreach($files as $file) {

     
       $image FCPATH 'images/catalog/' $file;

     
       if (is_dir($image)) {
     
           
                $data
['images'][] = array(
         
           'test' => ''
         
       );

     
       } else {

             
   $data['images'][] = array(
             
       'test' => $file
                
);

            }

     
   }

 
       $this->load->view('filemanager_view'$data);
    }

There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
Directory Helper Question - by wolfgang1983 - 02-04-2016, 03:28 AM
RE: Directory Helper Question - by InsiteFX - 02-04-2016, 03:34 AM
RE: Directory Helper Question - by wolfgang1983 - 02-04-2016, 10:33 PM
RE: Directory Helper Question - by keulu - 02-04-2016, 06:24 AM
RE: Directory Helper Question - by keulu - 02-04-2016, 09:42 AM
RE: Directory Helper Question - by wolfgang1983 - 02-04-2016, 09:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB