[eluser]iniweb[/eluser]
I have this code:
Code:
function Index()
{
$content = '';
$this->db->select('id, gal_name, description');
$this->db->orderby('id', 'asc');
$gallery = $this->db->get('galleries');
if($gallery->num_rows != '0')
{
foreach($gallery->result() as $gal)
{
$num = $this->db->query("SELECT * FROM ci_images WHERE gall_id = $gal->id");
$data = array(
'galleries_list' => $gallery->result_array(),
'count_images' => "$num->num_rows",
);
}
$content .= $this->parser->parse('Gallerys.tpl', $data);
}
$data = array(
'content' => $content,
'user_info' => $this->piclib->user_info(),
'user_enter' => $this->piclib->user_enter_form(),
);
$this->parser->parse('Main.tpl', $data);
}
All work, but count_images return latest value for all galleries.
Gallerys.tpl:
Quote:{galleries_list}
<tr>
<td align="center">
<a class="link555" href="/Gallery/{id}.html"><b>{gal_name}</b></a> <font class="text33"><b>(Images: {count_images}) </b></font>
</td>
</tr>
{/galleries_list}