I changed and now it does not show nothing. The directories exist on the folder.
i am giving you an example. If i echo $dir i get fullurlpath/root_folder/username
the whole path and directories exist so the $dir is ok, something else must happend.
class Front_Page extends CI_Model{
function front_display(){
$this->db->select('id, username');
$query = $this->db->get('models')->result();
$display_models = '<ul class="display-models">';
foreach ($query as $row){
$username= $row->username;
$dir = base_url('/img/'.$username.'');
echo $dir;
if(is_dir($dir)){
if($dh = opendir($dir)){
while(($file = readdir($dh)) !== FALSE){
$display_models .= '<li>';
$display_models .= '<a href="profilepage/'.$row->id.'">';
$display_models .= '<img src="'.$dir.'/'.$file.'">';
$display_models .= '</a>';
$display_models .= '</li>';
}
closedir($dh);
}
}
}
$display_models .= '</ul>';
return $display_models;
}
}