CRUD Question with Codeigniter

Posted by Brad on Stack Overflow See other posts from Stack Overflow or by Brad
Published on 2010-04-24T21:32:55Z Indexed on 2010/04/25 4:03 UTC
Read the original article Hit count: 229

Filed under:
|

I have a database with blog entries in it. The desired output I am trying to acheive is 3 entrys displayed using the css3 multi paragraph and then another 3(or more) formatted with the codeigniter Character_limiter. So I need 3 displays formatted one way and 3+ formatted another way on the same page.

So far this is what I have, but i do not know how to format the sql to achieve what I want. I can call all posts in descending order like I want, but dont know how to separate the code to achieve my output Controller:

$this->db->order_by('id', 'DESC');
$this->db->limit('2');
$query = $this->db->get('posts');
if($query->result())
$data = array();
{
$data['blog'] = $query->result();
}
$data['title'] = 'LemonRose';
$data['content'] = 'home/home_content';
$this->load->view('template1', $data); 

View:

    <?php if (isset($blog)): foreach ($blog as $row): ?>
<span class="title"><?php echo $row->title; ?> </span>
<?php echo $row->date; ?>
<div class="split"><?php echo $row->post =$this->typography->auto_typography($row->post); ?></div>
<?php echo 'Post #',$row->id; ?>
<p> Trackback URL: <? echo base_url()."trackbacks/track/$row->id";?></p>    
<hr />
<?php endforeach; 
endif;
?>

The split class is multiple columns. I tried 2 different querys but dont know how to separate all the post displays. Also one query always overides the second and produces all split or all character limited paragraphs.

Im lost here lol. Thanks

© Stack Overflow or respective owner

Related posts about codeigniter

Related posts about php