Welcome Guest, Not a member yet? Register   Sign In
Anchors help
#11

[eluser]Desireco[/eluser]
Thank you xwero. What I was looking for is to specify url parameters. I guess I can read them using uri_to_assoc method. I thought that there would be a method for specifying named url parameters in anchor helper method that is more elegant then what I did. Ah well.

Thanks for all suggestions.

Zeljko
#12

[eluser]xwero[/eluser]
You could extend the uri library
Code:
<?php
class MY_URI extends CI_URI
{
    
    function MY_URI()
    {
        parent::CI_URI();
    }

    function slice($string = null,$segments = null)
    {
        if(is_null($string))
        {
            return false;
        }

        $search = array_search($string,$this->router->segments);

        if(is_numeric($search))
        {
            if(is_null($segments))
            {
                return array_slice($this->router->segments,$search);    
            }
            elseif(is_numeric($segments))
            {
                return array_slice($this->router->segments,$search,$segments);
            }
        }
    }
    
}
?>
the controller code then would be
Code:
$this->uri->slice('keyword',1); // returns array with one value
$this->uri->slice('keyword'); // returns array with all values after the string
To be complete there should be a rslice too.
#13

[eluser]Desireco[/eluser]
Yeah I am thinking of what could be done Smile. Thank you.

[quote author="xwero" date="1196388190"]You could extend the uri library
[/quote]




Theme © iAndrew 2016 - Forum software by © MyBB