
Originally Posted by
gRoberts
This point might be a little bit past your current conversation, but not ALL frameworks require a database connection at start.
CodeIgniter has the option to load the database class as soon as the request is received, but like my current setup, it will only ever load the database object, when the database is needed. Otherwise, a request doesn't even touch the database.
That said. I love CodeIgniter for it's ease of use and what not, but I'm finding the thought of writing my own framework daunting, yet I feel compelled to write one.
I haven't had the chance to read every single post, explaining your current framework and the reasons for setting it up, but I think at the very simplest form, an MVC framework is the way to go.
When I first looked into MVC, it was scary. But CodeIgniter made it seem VERY simple, simple enough that I could create the MVC structure very easy. The parts I struggled with was handling of data etc to make it scalable.
In the end, I simply gave up. Until now, when your post, threw my brain into, hell, lets try it again mode lol
Hope it all pans out mate, and as everyone else is saying, get some code up so we can have a fiddle with it.
I went from Ruby on Rails to CodeIgniter back in ver 1.6 of CI and found it refreshingly simple. I didn't need migrations at the time and I felt more comfortable with pure SQL than some migration system so the CI db forge can make making your own simple migration system easy.
Also, CI makes it easy to find out if you have an AJAX request or not, to much of the chagrin of the poster on this page somewhere who said it could not.
Put that into the constants.php file in the app/config folder:
PHP Code:
//
// Define Ajax Request
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
//
Then you can use IS_AJAX in your controller to lock down if a call is ajax or not. That simple.
Your controller method would look like
PHP Code:
public function get_data() {
if(IS_AJAX) {
//retrieve data from somewhere
} else {
//print error that it was not an ajax call.
}
}
This sort of thing should probably be included in the base install but that is what makes CI so good, it can be tweaked to the needs of users. It might actually be something the OP wants to look into as it should be useful for any MVC.
Bookmarks