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

[eluser]wwendorf[/eluser]
Like I say, there is a very HUGE system. There are only 2 of us, and each are assigned to different projects. We are going to be writing all new projects in CI, and when we have downtime, we will convert existing portions of the system to use CI.

I did manage to figure out how to things working the way I originally described in my first post. I have full access to the CI framework, and full access to the old framework. It took some major tweaking, but it's looking pretty good so far.

Thanks,
Wade
#12

[eluser]Fabdrol[/eluser]
[quote author="wwendorf" date="1306896765"]Here is the source code. Be warned, it is NOT pretty.

Wade[/quote]

Where?
#13

[eluser]wwendorf[/eluser]
It is attached to the original post.

Sorry about that.

Wade
#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;
    }

}
#15

[eluser]wwendorf[/eluser]
Yes, I know. It's very messy code that I get to maintain and modify. Luckily, I have a knack for reading thru and supporting messy code. I have been involved in too many messy code projects that I have had to clean up. My "best" (read "worst") messy code project was a c++ application that was 20,000 lines long, and written without ANY functions, all goto's. That made this this code look like a picnic on a sunny day.

As far as tying it into CI, it actually that I have it working, and at least as fast as with CI involved, and I didn't need to modify any of the core functionality of CI, so it's a plus in my mind. As far as the comment about updating in 3 places, there is a menu file written in messy PHP, another one written in equally messy Zend framework. The reason I'm trying to tie the CI into the existing architecture is so that I don't have to create and maintain an all new menu from within CI. The app I'm working on is a program for our Reps to manage their clients and get new sales leads.

The goal is to do all new development in CI, as well as any code that needs modification will be rewritten in CI. It will be a gradual rewrite. It has to be because we don't have the time to pull all our programming resources to a complete rewrite, at least on the client manager portion of our system.

This application has grown over 8 years and is at the "messy and unmanageable code" stage, hence the introduction of a framework that is flexible enough to do things the way we need to do them, instead of forcing us into more work by having to conform to a particular methodology, like Zend tries to make you do. CI is also a lot faster than Zend, with a lot less overhead.

Thanks,
Wade
#16

[eluser]Fabdrol[/eluser]
hehe, well success anyway. If you need help with something else, there's always somebody here to help you out!

Fabian
#17

[eluser]wwendorf[/eluser]
Thanks! I appreciate the comments and suggestions. You gave me some good ideas that I will likely be implementing. Now I just have to figure out a solution for the 404_override bug that is in 2.0.2. It doesn't work correctly and I don't have time to fix the bug myself. I had to modify the errors/error_404.php file to do what I needed to do. Oh well!

Take care,
Wade
#18

[eluser]wwendorf[/eluser]
Well, I thought I would follow up with my last post. I have had great success getting Codeigniter functioning inside my current application. All in all, it was a lot easier than I thought it would be.

The main thing I was having trouble with was transitioning outside of CI when clicking a link for a portion of the system that was PHP or ZEND. CI was trying to keep the index.php/ after the domain name. After a little messing around, I got it forwarding everything properly.

So, I know have codeigniter added into my current system and all my new development is taking place inside code igniter. Thanks to everyone who replied to me.

Wade




Theme © iAndrew 2016 - Forum software by © MyBB