Welcome Guest, Not a member yet? Register   Sign In
How to manager different projects with similar code?
#4

[eluser]darkhouse[/eluser]
The only issue with updating your skeleton and having it update all projects that use it is that it may break something else in a particular project. My thinking is, if your project works, then leave it alone. If you make changes to the skeleton, don't go back and apply the changes to the previous projects, just leave them with the old code.

In my case I have about 10 sites currently using CI, and I expect to use it for another 20 or so sites this year. I would hate to update each project, test each project, then fix each project just because I added some new feature to the skeleton. If the old projects work, they don't need to be updated, so I only apply the new skeleton to whatever project I'm working on at the moment.

As for my modular code structure, it's really just some libraries I wrote. I wrote my own user authentication which supports different user groups. I have a library for managing css and javascript files on a per page basis (as well as css and javascript snippets that aren't necessarily in their own files). I wrote a forwarding system, so if you need to be logged in before you can access a page, it redirects you to the login page and sends you back to the page you were on after a successful login. I built an output message system that allows me to easily write and display error messages and success messages. If you're not redirecting you can send messages to the library, but if you are redirecting, you can just set the messages in flashdata which the library will read upon reload. I think that's about it for things I've built myself...

The other things I've done is change the Router and Form_validation libraries. I didn't extend them, they are replacements. In Form_validation, I thought it was odd that you can set validation groups in a config file, but not directly in a controller, so I changed that. I don't think I'll ever use a config file for validation rules because most of my projects have a number of forms and things. It made more sense to set up groups from within the controller, but it wasn't working. I investigated and found out it just wasn't supported outside of a config file.

In the Router library, I changed it to allow multiple subdirectories (which I found code for in the forums here), and I also added in my own system which will eventually be used for a CMS in CI. What it does is instead of displaying a 404 when it can't find a controller, it sends the URI string to a CMS controller which will take that string and load whatever template, content, etc. I haven't finished that yet, but the Router part is working. We actually used this system for another site that we're converting from old crappy code to CI. We made it so for the pages we haven't converted yet, you can still use the same URI to access the page. The router can't find the controller so it loads the CMS controller, which then reads the content of the page (including any javascript and css) and displays it in our CI template. It worked really well. We were originally trying to do that with .htaccess so that if the URI contained .php but not index.php it would send the URI to a controller to grab the content of that page, but we couldn't get the .htaccess to work.

That's pretty much my skeleton right there. The only other thing is the Admin area which is a template and uses the user authentication system.


Messages In This Thread
How to manager different projects with similar code? - by El Forum - 01-01-2009, 09:59 PM
How to manager different projects with similar code? - by El Forum - 01-02-2009, 12:31 AM
How to manager different projects with similar code? - by El Forum - 01-02-2009, 10:38 AM
How to manager different projects with similar code? - by El Forum - 01-02-2009, 11:09 AM
How to manager different projects with similar code? - by El Forum - 01-02-2009, 11:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB