[eluser]coldKingdom[/eluser]
I have now come to a solution and i would like to share some with you all
Model:
Code:
function get_gallery($user) {
$this->db->from("tbl_gallery_albums");
$this->db->where("album_user", $user);
$query = $this->db->get();
$albums = $query->result_array();
foreach ($albums as $album):
$this->db->from("tbl_gallery");
$this->db->where("gallery_album", $album["album_id"]);
$query = $this->db->get();
$data[$album["album_name"]] = $query->result_array();
endforeach;
return $data;
}
View
Code:
<?php
foreach ($data["gallery"] as $key => $index):
echo heading($key, 3);
echo '<table cellspacing="0" cellpadding="0" style="float:left;"><tr>';
$count = 0;
foreach ($index as $item):
$img_attr = array(
'src' => '/uploads/pictures/small/'.$item["gallery_picture"],
'alt' => '',
'style' => "margin-right:3px;"
);
$link_attr = array(
'rel' => "shadowbox[".$item['gallery_album']."]",
'title' => ""
);
$count++;
print "<td>";
print anchor('/uploads/pictures/large/'.$item["gallery_picture"], img($img_attr), $link_attr);
print "</td>\n";
if (($count % 4) == 0):
echo "</tr><tr>";
$count = 0;
endif;
endforeach;
echo "</table>\n";
endforeach;
?>
Thank you for a good forum!