Welcome Guest, Not a member yet? Register   Sign In
Trying to show a single blog post
#1

[eluser]kaos78414[/eluser]
So for practice I'm trying to create a blog with commenting functions and AJAX and all the normal stuff.

The problem I ran into, is I can't seem to pull a single entry for viewing. I have the entries truncated on the first page with a read more link, to bring them into full view.

This is the code for in the controller for viewing a blog entry:
Code:
function view() {
        $data['post'] = $this->blogmodel->get_view();
        $data['content'] = 'postview';
        
        $this->load->view('includes/template', $data);
    }

And this is in the model:
Code:
function get_view(){
        $this->db->where('blogId', $this->uri->segment(3));
        $query = $this->db->get('blogposts');
        
        if ($query->num_rows() == 1) {
            return $query->row();
        }
        
        return FALSE;
    }

And the view has:
Code:
<div id="post">
    <div id="post-title">
        &lt;?php echo $post->blogTitle; ?&gt;
    </div>
    <div id="post-body">
        &lt;?php echo $post->blogBody; ?&gt;
    </div>
</div>


I've done some tutorials, but I just can't seem to see what I'm doing wrong here. Can anyone enlighten me?


Messages In This Thread
Trying to show a single blog post - by El Forum - 05-20-2010, 06:53 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 06:56 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 07:26 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 09:53 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 10:00 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 10:01 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 10:01 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 11:23 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 11:32 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 11:49 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 11:58 AM
Trying to show a single blog post - by El Forum - 05-20-2010, 12:10 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 12:24 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 12:53 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 12:58 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 01:10 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 01:15 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 01:23 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 01:29 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 03:15 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 05:17 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 05:33 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 05:46 PM
Trying to show a single blog post - by El Forum - 05-20-2010, 05:57 PM
Trying to show a single blog post - by El Forum - 05-21-2010, 12:51 AM
Trying to show a single blog post - by El Forum - 05-21-2010, 01:34 AM
Trying to show a single blog post - by El Forum - 05-21-2010, 07:44 AM
Trying to show a single blog post - by El Forum - 05-22-2010, 06:02 AM
Trying to show a single blog post - by El Forum - 05-24-2010, 09:04 AM
Trying to show a single blog post - by El Forum - 05-24-2010, 10:10 AM
Trying to show a single blog post - by El Forum - 05-24-2010, 12:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB