11-27-2012, 09:15 PM
[eluser]apodner[/eluser]
Here's a quick & dirty possibility (but the better solution is to set this all up as separate methods in a model):
View: ( I assume each gallery goes with one figure tag)
Here's a quick & dirty possibility (but the better solution is to set this all up as separate methods in a model):
Code:
$galleryQuery = $this->db->get('gallery');
foreach ($galleryQuery->result_array() as $key => $row) {
$data[$key] = $row;
$this->db->where('gallery_id', $row['id_gallery']);
$imgQuery = $this->db->get('images');
$data[$key]['images'] = $imgQuery->result_array();
}
return $data;
View: ( I assume each gallery goes with one figure tag)
Code:
<?php
foreach($data as $gallery) { ?>
<figure>
<?php
foreach($gallery['image'] as $image) {
/* code for whatever you do with each image in the figure */
}
?>
</figure>
<?php
}
?>