Hello I am trying to create a simple gallery CMS. All the pictures will be saved in uploads/ folder in the root of Codeigniter. Looks like my errors have to do with php programming. I am trying to print the pictures gallery to the screen:
controllers/upload.php
<?php
class Upload extends CI_Controller {
function gallery_show()
{
foreach($pictures as $pic)
{
$data['html'] .= '<img src="uploads/'.$pic['thumbname'].'">';
}
$this->load->view('gallery', $data);
}
}
?>
views/gallery.php
<?php echo $html; ?>
I receive this error message:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: pictures
Filename: controllers/upload.php
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: controllers/upload.php
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: data
Filename: controllers/upload.php
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: html
Filename: core/Loader.php(829) : eval()'d code
Line 42: foreach($pictures as $pic)
Line 47: $this->load->view('gallery', $data);
Anyone can help me solve this problem?