Welcome Guest, Not a member yet? Register   Sign In
Trying to use codeigniter in an existing project
#14

[eluser]Fabdrol[/eluser]
Hi Wade,

That's kinda a mess... but, anyway. I didn't read the entire file, way to much messy code. I'll be honest, tie-ing thát into CI is going to be a very, very hard and long-lasting job, mainly because it's a mixture of data (the sessions and the data from the database), of functionality and even of view-code, namely the font-size setting (I'm not sure what's that doing there). Anyway, I don't really see a time-efficient way of plugging this into CI, and also using the code.

You talked about 'having to update in three places', could you tell me more about your current systems architecture? Is menu linked to some kind of CMS, how are they interlinked? What kind of app are you building/revising? If all the code is as messy as the code in that file, I truly believe you'd be spending less time by rewriting the entire HUGE app, which will then probably be much less HUGE, then when you try to integrate systems in the way you describe... If you do so, you should expect a lot of writing glue code, rewriting and deleting et cetera.

If all you need from logincode.php is the repdata array, I'd write a small model or library to fetch that same data. Right now you fetch this array using a session and a query, in CI you can easily do the same:

Code:
<?php if(!defined('BASEPATH')) exit('Direct script access denied');

class Repdata extends CI_Model {

    private $data = false;

    public function __construct() {
        parent::__construct();

        $sess = $_SESSION['agent_id'];
        // assuming that it's set in some other file, since CI uses its own sessions
    
        $this->db->where('aid', $sess);
        $sql = $this->db->get('table_name');
    
        if($sql->num_rows() > 0) {
            $this->data = $sql->result_array();
        }
    }

    public function get_data() {
        return $this->data;
    }

}


Messages In This Thread
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 08:46 AM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 09:25 AM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 09:35 AM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 09:38 AM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 10:54 AM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 11:17 AM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 11:50 AM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 11:54 AM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 03:52 PM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 04:15 PM
Trying to use codeigniter in an existing project - by El Forum - 05-31-2011, 04:39 PM
Trying to use codeigniter in an existing project - by El Forum - 06-01-2011, 12:22 AM
Trying to use codeigniter in an existing project - by El Forum - 06-01-2011, 10:08 AM
Trying to use codeigniter in an existing project - by El Forum - 06-01-2011, 10:37 AM
Trying to use codeigniter in an existing project - by El Forum - 06-01-2011, 11:01 AM
Trying to use codeigniter in an existing project - by El Forum - 06-01-2011, 11:05 AM
Trying to use codeigniter in an existing project - by El Forum - 06-01-2011, 11:08 AM
Trying to use codeigniter in an existing project - by El Forum - 06-21-2011, 08:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB