Olá galera, eu estou usando um script embora o script esteja funfado certinho, fica um erro visualmente chato no topo do site... o erro é: A PHP Error was encountered Severity: Notice Message: Undefined variable: table Filename: controllers/fotos.php meu arquivo fotos.php ta assim: <?php
class Fotos extends Controller {
function _imagens($dir){
if(!$dir){$dir = '.';}
foreach(glob("$dir/*") as $item){$sort[]= end(explode('/',$item));}
$killit = array('index.html', 'index.php', 'thumbs.db', 'styles.css');
$killcounter = 0;
foreach($sort as $sorteditem){
foreach($killit as $killcheck){
if(strtolower($sorteditem) == strtolower($killcheck))
{unset($sort[$killcounter]);}
}$killcounter++;}
if($sort){natsort($sort);}
foreach($sort as $item){$return[]= $item;}
if(!$return){return array();}
return $return;
}
function galeria($galleryName)
{
$this->load->helper('url');
$query = $this->db->query("SELECT IMAGE FROM TB_IMAGES WHERE DESCGALERIA = '$galleryName'");
$result = $query->result_array();
if ($query->num_rows() > 0){
echo 'teste';
$this->output->cache(999999);
$table.="</table>\n";
foreach ($query->result_array() as $row)
{
$url = base_url().$galleryName;
$table.="<tr>\n<td align=\"center\" cellspacing='4'>";
$table.="<a href='http://www.mysite.com' target='_blank'><img src=\"$url/".$row['IMAGE']."\" alt='www.mysite.com' class='thumbHome' border='4'></a>";
$table.="<br/>";
$table.="</td>\n</tr>\n";
}
$table.="</table>\n";
$dados['table'] = $table;
$dados['pageTitle'] = 'Galeria de Fotos';
$this->load->view('galleryView',$dados);
}
else {
$allimages = $this->_imagens($galleryName);
print_r($allimages);
foreach($allimages as $image){
$sql = "INSERT INTO TB_IMAGES (DESCGALERIA,IMAGE) VALUES (".$this->db->escape($galleryName).", ".$this->db->escape($image).")";
$this->db->query($sql);
}
}
}
}
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */
?>