Welcome Guest, Not a member yet? Register   Sign In
uri_segments() not working
#1

[eluser]jaswinder_rana[/eluser]
I read in the documentation (http://ellislab.com/codeigniter/user-gui...elper.html) about this function. But, when I tried to use it, it din't work.

After spending 15 minutes on why it's not working, I checked helpers/url_helper.php. It doesn't have uri_segments() function rather it has uri_string().

Do I have the wrong file or is it the documentation?

Thanks
#2

[eluser]sofbas[/eluser]
No, it has been renamed but did not make it to the documentation.

Search the forum for uri_segments() and you'll get the answer.
#3

[eluser]AndrewMalachel[/eluser]
check http://ellislab.com/codeigniter/user-gui...s/uri.html too see the documentation about URI..

and also see http://ellislab.com/forums/viewthread/100250/ for a problem example (solved) regarding URI...

hope it could help... :-)
#4

[eluser]jaswinder_rana[/eluser]
Thanks.

I had it working with uri_string(). I just wanted to make sure whether uri_segments() was there at all or was it error in documentation.
#5

[eluser]fRkSsK[/eluser]
hi,
i have a problem with uri->segments() function.

my url is:

Code:
index.php/first/myList/1

my controller page's code:
Code:
function myList() {
    
    $this->db->where('category_id', $this->uri->segments(3));

    $data['category'] = $this->db->get('products');

}
my view page:
Code:
<?php if ($category->num_rows() > 0): ?>
            
    <?php foreach($category->result() as $row): ?>
                
              <a href="#">&lt;?=$row->product_name;?&gt;&lt;?=br(1);?&gt;</a>
                    
        &lt;?php endforeach; ?&gt;
            
&lt;?php endif; ?&gt;
but it's not works. error code is:
Code:
Call to undefined method CI_URI::segments() in ~~~~
what is the problem?
#6

[eluser]fRkSsK[/eluser]
upps.
i changed this code;

Code:
$product_id = $this->uri->segment(3);

$this->db->where('category_id', $product_id);

and it's works..




Theme © iAndrew 2016 - Forum software by © MyBB