 <div class="center_content">  

<?php 
$cats_no=0;
foreach($mods->result() as $row):
 if($row->have_cats=='yes')
{
$cats_no++;
$items[]=$row->name;
$titles[]=$row->title;
}
endforeach;

?>


<div class="left_content">
    
    		<!--<div class="sidebar_search">
            <form>
            <input type="text" name="" class="search_input" value="search keyword" onclick="this.value=''" />
            <input type="image" class="search_submit" src="template/images/search.png" />
            </form>            
            </div>-->
      <?php if($cats_no>0){?>
            <div class="sidebarmenu">
            
                    <a class="menuitem submenuheader" href=""> Categories </a>
                <div class="submenu">
                    <ul>
                 <?php
                 $i=0;
                foreach($items as $r):?>

                        <li><a href="<?php echo base_url();?>index.php/categories/index/<?php echo $titles[$i];?>"><?php echo $r;?></a></li>
                          <?php $i++; endforeach;?>
                         
                         </ul>
                </div> 
                <?php }?>  
                

            
           <?php foreach($mods->result() as $row):?>
    
                <a class="menuitem submenuheader" href="">  <?php echo $row->name;?></a>
                <div class="submenu">
                    <ul>
                    <li><a href="<?php echo base_url();?>index.php/posts/index/<?php echo $row->title;?>/all">All Posts</a></li>
                    <li><a href="<?php echo base_url();?>index.php/posts/index/<?php echo $row->title;?>/active">Active Posts</a></li>
                    <li><a href="<?php echo base_url();?>index.php/posts/index/<?php echo $row->title;?>/nonactive">NonActive Posts</a></li>
                    <li><a href="<?php echo base_url();?>index.php/posts/add_post/<?php echo $row->title;?>/<?php echo $status;?>">Add New</a></li>
                    </ul>
                </div>   
                 <?php endforeach;?>

               
               <!-- <a class="menuitem" href="">User Reference</a>
                <a class="menuitem" href="">Blue button</a>
                -->
                
                <a class="menuitem_green" href="<?php echo base_url();?>index.php/musers/">Users</a>
                
                <a class="menuitem_red" href="<?php echo base_url();?>index.php/settings/">Settings</a>
                    
            </div>
            
            
    </div>