Controllers vs an Advanced Module
Thanks in advance for responding to what is undoubtedly obvious if you've done it before ...
I have a series of huge forms which are not going to be friendly if auto-created by fuel -- to put it in perspective, one of them will populate 70 checkboxes using an imagemap and a slug of javascript to keep it sane... -- I count 10 rather complex forms and then I'm going to need to check and save the data.
Up until now, everything has been in simple modules and I've successfully let Fuel generate the edit forms. Conceptually, nothing here goes beyond the simple module concept, but I'm not finding answers in any of the available examples.
I suspect I'm struggling with "boundaries" between CI and Fuel. I'm trying to do something that was easily done with one controller, one model, and multiple views in CI 1 + BackendPro.
I easily get the controller within the Fuel application to execute a "got there" , but I don't seem to then be able to load a model that follows the Fuel specifications -- I get Fatal error: Class 'Base_module_model' not found in \application\models\plants_model.php on line 3.....so should I be heading for basic CI and ignoring FUEL for this?
If so, can I get to my Fuel views/blocks/layouts? Can I still get to Fuel check to see if my user is logged in validly? I'd clearly like to use Fuel's validation enhancements. Possible?
I'm suspecting that I just need to know something basic that I'm failing to find in the Fuel documentation....you focused on simplifying by not needing a controllers, but at this point, I'm fairly sure I need one or several, and I'm truly confused about how to integrate Fuel with standard CI controllers.
Thanks for putting up with me.
Shirley
Comments
http://www.getfuelcms.com/user_guide/modules/advanced
With regards to that Fatal error, make sure you include the Base_module_model file like so in your model at the top:
require_once('base_module_model.php');
I went the "controller" route and it is working with one exception and I'm hoping you may have a clue. And if you tell me I should have created a model -- I'll hear the "I told you so" and go do it.
I use form_builder, I use a model constructed exactly the same as the it would be had I let fuel handle the whole process. I look at the generated form code, it looks good to my eye. Form fields of all types work except images -- but I never get an uploaded image (I verified by immediately getting the posted variables and doing an r_print on them before any other processing of the form happens -- I get everything else). I tried loading the edit view with and without 'render_mode'=>'cms' and it made no difference.
The form generator code: Below: the results of the r_print and the ultimate upchuck by My_Model that the "photo_image" does not exist A few other tests lead me to suspect that something in the processing before control gets to my controller code is stripping the 'photo_image'. One of my tests involved turning off xss but I thought it was already off, and possibly I was turning it off the wrong way?
Again, thanks.
photo_image is a form field -- and the form html looks right, including the additional image-related fields that fuel generates
The browser does properly allow browsing for an image -- but
photo_image never makes it to plants/updatephoto
Somewhere between the form and the controller function updatephoto, photo_image goes into never-never land.
(note the r_print of the post variables received by plants/updatephoto -- it gets every field except photo_image)
That was definitely the problem. I struggle so much trying to learn "object oriented" and use CI that I forget basic PHP!