Welcome Guest, Not a member yet? Register   Sign In
URL routing-rewrite issue
#8

[eluser]Animas[/eluser]
Here is my updated code
parts of blog.php
Code:
function post()
    {
        $data['title'] = "My Page Title";
        $data['heading'] = "My Page Heading";
        $this->db->where('title', $this->uri->segment(3));
        $data['query'] = $this->db->get('entries');
        $this->load->view('post_view', $data);
        
    }

parts of blog_view.php
Code:
<h1>&lt;?php echo $heading;?&gt;</h1>
&lt;?php if ($query->num_rows() > 0): ?&gt;
    &lt;?php foreach($query->result() as $row):?&gt;
    <h3><a href="blog/post/&lt;?=$row->title?&gt;">&lt;?=$row->title?&gt;</a></h3>
    <p>&lt;?=$row->body?&gt;</p>
    <hr />
    &lt;?php endforeach; ?&gt;
&lt;?php endif; ?&gt;

parts of post_view.php
Code:
<h1>&lt;?php echo $heading;?&gt;</h1>
    
&lt;?php if ($query->num_rows() > 0): ?&gt;
    &lt;?php $row = $query->row(); ?&gt;
    
    <h3>&lt;?=$row->title?&gt;</h3>
    <p>&lt;?=$row->body;?&gt;</p>
    
&lt;?php endif; ?&gt;

But still the same problem. When clicking title "My Page Heading" is printed but noting from that particular post. I used to see post only when I used id instead of title. When a title link is clicked in blog_view, it opens the post_view.

Can't there be duplicate title? But id will be unique. It would be nice if you could suggest me what changes I should do inside this code.


Messages In This Thread
URL routing-rewrite issue - by El Forum - 04-06-2008, 12:39 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 02:44 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 03:25 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 05:44 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 05:50 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 06:00 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 06:03 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 06:12 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 07:11 AM
URL routing-rewrite issue - by El Forum - 04-06-2008, 07:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB