Hi I am having portfolio table where i am inserting all my portfolio list.While inserting the portfolio list i will inserting tags which are separated by commas.But while fetching data it should in this
Controller:
$data["records2"] = $this->portfolio_model->get_portfolio();
$data['mainpage'] = "portfolio";
$this->load->view('templates/template',$data);
Model:
function get_portfolio()
{
$this->db->Select('portfolio.*');
$this->db->From('portfolio');
$this->db->where(array('portfolio.status'=>1));
$q=$this->db->get();
if($q->num_rows()>0)
{
return $q->result();
}
else
{
return false;
}
}
View:
<div class="materials">
<div class="class453">
<a href="#" class="read_more12">All</a>
</div>
<div class="class455">
<a href="#" class="read_more13">E-Commerce</a>
</div>
<div class="class459">
<a href="#" class="read_more14">Cms</a>
</div>
</div>
<?php
$cnt = 0;
if(isset($records2) && is_array($records2)):?>
<?php foreach ($records2 as $r):?>
<div class="portfolioimages">
<a href="<?php echo $r->website_url;?>" target="_blank"><img src="<?php echo base_url();?>admin/images/portfolio/thumbs/<?php echo $r->image_path;?>" /></a>
</div>
<?php if(($cnt%3) == 0) { echo "<br>"; }
$cnt++; endforeach; endif;?>
</div>
In my database it will be inserting the data in the format:
while fetching data it should get all the data but if we click on CMS only the data for that particular tag should be displayed. Ex: if we select cms then 1,3,4 id should be displayed because they are cms tags,If we select E-commerce then 1,2,4 id should be displayed.How can be these done.
