Modular Extensions - HMVC version 5.2 |
[eluser]bugboy[/eluser]
is there a way to load a modules model into a library? I've tried using: Code: $this->ci->load->model('media/media_model', NULL, FALSE); With no joy. I used to use a modified version of this library that could do this but you'd have to put the modules name at the end. for example Code: $this->ci->load->model('media_model', NULL, FALSE, 'media');
[eluser]CoolGoose[/eluser]
After installing Modular Extensions it seems that {elapsed_time} doesn't work anymore . Any tips ?
[eluser]Enshteyn[/eluser]
Hi. I have 2 controller module access: access.php admin.php The library MX_Controller.php I have 3 objects: Base parent Controller Frontend parent Base Backend parent Base Initializing controller access checking constructor function get_parent_class($this); Controller access.php parent class Frontend Controller admin.php parent class Frontend and class Backend. I need to inherit only the Backend. How to do this?
[eluser]wiredesignz[/eluser]
@CoolGoose, The elapsed time bug is resolved in the latest version of Modular Extensions - HMVC. @Enshteyn, I assume that English is not your native language but could you please try to explain your problem more clearly.
[eluser]wiredesignz[/eluser]
@Enshteyn, Your image shows procedural code inside each class, but not inside a class method, this is impossible.
[eluser]wiredesignz[/eluser]
Modular Extensions HMVC version 5.2.15 is now available on the wiki. Updated to allow access to module resources when using get_instance() within libraries.
[eluser]CtheB[/eluser]
Hi wiredesignz, Thank you again for all your great work. You, and ofcourse derek jones, are my true heroes. Today i looked into PDO, that i want to use in my codeigniter applications in the near future. The next story is how i just did this. Please have a look at it, comments are really appreciated. (I will explain everything at very low level, so other users can follow along and use it as well) So i begun with another clean codeigniter installation, and i installed the latest version, 5.2.15, of HMVC. After that, i looked into the forums and wiki, if there were any good topic about integrating PDO into codeigniter. I've found some topics about SQlite 3 and PDO (http://codeigniter.com/wiki/PDO_SQLite3/), but this is really bad practise, because one of the main purposes of pdo is that you can change dbdriver when you have to. And with this method, you are forced to use SQlite.. (not that sqlite is bad, but there are plenty of examples we need to use another dbdriver) After that i saw this topic: PDO in Codeigniter. It works fine ofcourse, but i really don't want to mess in one of the system files (DB.php). Because there might be a situation pdo will not be used or DB.php will be overwritten by accident when updating to the next version. Next moment i thought: I'll write MY_Loader.php and edit the database functions. But 1 sec later I thought, ofcourse, the database functions in MY_Loader.php are not used because I have the custom Controller from HMVC were the database function is added... So i came with the following solution. I want to ask you kindly to review my solution and look if my solution is good practise at all? And if it might be integrated into the next version of HMVC (with some modifications ofcourse if necessary). I really appreciate your comments. First, I modified the database function in the HMVC's Controller.php Code: /** Load the database drivers OR the PDO object **/ Second, I added an extra option to the $db array in application/config/database.php Code: $db['default']['pdo'] = TRUE; Now i can use PDO in my models like this: Code: function show_categories() This will return an object with all the results. First you add next line to your controller method: Code: $data['categorie'] = $this->home_model->show_categories(); And next you can use it in your view: Code: if(isset($categorie)) Everything is up and working. And i really see a hugh drop in the benchmarking from 0.0380 to 0.0278. (but that could be just lucky since these tests are not scientifically proven after all). I'll hope everything in this topic is well written so everybody in the community could understand it. Please wiredesignz feel free to look into this and tell me of this code could be improved in any kind of way. Thanks again and good night for everybody
[eluser]wiredesignz[/eluser]
Hi CtheB, I can see you've put some effort into this but I can't help wondering if this might be better suited to a separate library that uses something like the "factory" design pattern to generate PDO objects and replace $db as needed.
[eluser]CtheB[/eluser]
Hi, You are one step in front of me. I like to take it step for step. Next step was to make it into a seperate library with a "PDOFactory" class and some Object Relational Mapping classes. But that is not where i was talking about now. You need to take into account that not everybody will understand all of this directly. So i'll like to first to look at my post before. Is the code o.k. or do you think it could be improved? When we agreed on that we could take it to the next step and look at the factory thing. Do you have any suggestion how to communicate in the Controller class with the Factory classes? |
Welcome Guest, Not a member yet? Register Sign In |