Welcome Guest, Not a member yet? Register   Sign In
URI not working
#1

[eluser]RJ[/eluser]
Hello,

I'm new to code igniter, but catch on pretty quick.. i think. I'm trying to utilize the URI functioning, but it doesnt appear to be working.

My controller has a method "Device" see below:
Code:
function device($dealer = '999')
    {
        $this->benchmark->mark('code_start');
        // start benchmarking

            $dealer = array('dealer' => ''.$dealer.'');
            $this->load->library('dealer', $dealer);      // passes dealer                    $this->load->helper(array('form', 'url'));    // load helpers
                 $this->load->library('form_validation');    // load libraries
            $this->form_validation->set_error_delimiters('<div class="error">', '</div>');    // set error wrapper

Device is calling a library "Dealer" and passing the $dealer URI value (note i hand made an array there because wasnt working directly... doesnt work in array either).

Now in Dealer i am grabbing dealer data from the db and adding to a session:
Code:
function Dealer($dealer)
    {
        print_r($dealer);
        // submit log entry
        log_message('debug', "Dealer Class Initialized");        // debug log
        // load ci instance
        $CI =& get_instance();
        // on screen php error display
        ini_set('display_errors', 1);
        
        $this->vars = $this->grab_vars($dealer['dealer']);        // grab dealer info from db
        
        $CI->session->set_userdata('dealer',$this->vars);        // add dealer info to session
        
        // submit log entry
        log_message('debug', "Dealer routines successfully run");
    }

Except I can't get the dealer code to load from the URL, my URL is below:
Code:
http://localhost:85/s/index.php/shop/device/101

Where "101" is supposed to be the dealer code. I do have URI library auto-loaded.

Thanks for your help!!
#2

[eluser]xwero[/eluser]
the uri library is loaded by CI and it will loose its values if you load it manually because it gets the values from the router class
#3

[eluser]RJ[/eluser]
Awesome, that fixed the problem, thanks a million!




Theme © iAndrew 2016 - Forum software by © MyBB