EllisLab text mark
Advanced Search
19 of 23
19
   
Modular Extensions - HMVC version 5.4
Posted: 26 July 2012 07:45 AM   [ Ignore ]   [ # 271 ]   [ Rating: 0 ]
Avatar
Joined: 2012-06-09
82 posts

thanks for your reply sir smile I’m using it right now and i really liked it! So this extension is really stable. Thanks again for your reply sir smile one more question.. If a new version of CI comes out can I safely upgrade my site built w/ codeigniter and this modular extension?

 
Posted: 26 July 2012 08:00 AM   [ Ignore ]   [ # 272 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-10
2919 posts

Yes of course. Modular Extensions - HMVC will continue to match CodeIgniter development for as long as possible.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

 
Posted: 26 July 2012 08:21 AM   [ Ignore ]   [ # 273 ]   [ Rating: 0 ]
Avatar
Joined: 2012-06-09
82 posts

okay sir thanks for the info and for your hard work. I’m using this extension now and in fact I’m now rewritting my code from MVC to HMVC because it will be a large compilation of codes after months of development and by using this extension the codes will be more easy to maintain and modify because it will be more organized. Thanks again smile

 
Posted: 26 July 2012 10:35 AM   [ Ignore ]   [ # 274 ]   [ Rating: 0 ]
Avatar
Joined: 2012-06-09
82 posts

Hi, can someone please give me a link in how would I integrate Ion Auth library in a CodeIgnier w/ modular extensions HMVC setup? Or can someone give me ideas how to integrate it?

EDIT:

Problem solved.
http://ellislab.com/forums/viewthread/221689/

 
Posted: 14 August 2012 06:20 PM   [ Ignore ]   [ # 275 ]   [ Rating: 0 ]
Joined: 2010-10-24
1 posts

There appears to be a bug in the HMVC loader class when loading a library using an alias.  I need two different instances of a library on the same page. 

For instance,

  $this->load->library(‘template’, NULL, ‘instance_1’);

  $this->load->library(‘template’, NULL, ‘instance_2’);

But I always get back instance_1.

The problem appears to be in the MX/Loader method library().  Once the first load of the library class get cached, it always returns and doesn’t allow the alias logic for the second call to execute

public function library($library = ‘’, $params = NULL, $object_name = NULL) {

  if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class])
return CI::$APP->$_alias;

}

Am I missing something?

thx

 

 
Posted: 10 September 2012 04:26 AM   [ Ignore ]   [ # 276 ]   [ Rating: 0 ]
Joined: 2010-11-16
30 posts

the latest changes in CI develop, the config/autoload.php

add a new “driver” category, HMVC does not support it yet

details:
https://github.com/EllisLab/CodeIgniter/commit/f8f36db2d967efe8178b78a59ead14c05f50dc12
https://github.com/EllisLab/CodeIgniter/commit/ac740abc89159fe24165105253ae6048888a16ee
https://github.com/EllisLab/CodeIgniter/commit/1e40c213610a4bb643e51c2b298629471664163b
https://github.com/EllisLab/CodeIgniter/commit/9ffcee60140b20ca3ec4e7688f83a039c7c080f7

hope we will get some update soon.

 
Posted: 17 September 2012 04:22 AM   [ Ignore ]   [ # 277 ]   [ Rating: 0 ]
Avatar
Joined: 2012-07-19
32 posts

I’ve been playing around with HMVC for a little while now, but I’m trying to do something now that’s pushing rather hard on the boundaries of my PHP knowledge.. So, here’s me hoping someone here could help point me in the right direction or give me a few tips. smile

For the moment all I’m looking at is the loading of views. Currently, this HMVC extension checks for the requested view in the ‘application/[current_module]/views’ first, then the default ‘application/views’ folder if the first is false. In my little pet project, I would like to insert my own ‘view’ folder location check just before the HMVC one.

Working with the following folder structure:

/* -------------------------------------
- application
  - modules
    - module_a
      - controllers
        - module_a.php
    - module_b
      - controllers
        - module_b.php
      - views
        - module_b.php
    - module_c
      - views
        - module_a.php
        - module_c.php
------------------------------------- */ 

If I do something like this:

class Module_a extends MX_Controller {
    
public function index() {
        $this
->load->view('module_a');
    
}

I would like to check the ‘module_c’ views folder first for a match, then the current module (module_a) if the first check is false. Just to add another interesting twist, I’ve already completely removed the default ‘application/views’ folder, since it’s not going to be used for this project. smile

Would I need to edit the ‘public function view()’ function in ‘third_party/MX/Loader.php’, or could I perhaps do this outside of that file?

 
Posted: 17 September 2012 06:32 AM   [ Ignore ]   [ # 278 ]   [ Rating: 0 ]
Joined: 2010-02-23
55 posts

Thanks wiredesignz, HMVC absolutely essential for my developments.

I have made a mix between CI 2.1.2, HMVC 5.4 and a common application folder.

Inside the common application folder are the HMVC, leaving the normal application folder untouched.

Also, with common folder, you can have modules, libraries, helpers, third_party, shared between many application folders.

This is a basic approach to those who need a general application (modules, controllers, views, libraries, helpers, language, etc, but only a small customization is needed for different purposes.

Then, you have a ‘common’ folder, also a ‘application1’ folder, ‘application2’ folder and so on…

Take a look at: https://bitbucket.org/xperez/codeigniter-cross-modular-extensions-xhmvc

 
Posted: 25 September 2012 09:08 PM   [ Ignore ]   [ # 279 ]   [ Rating: 0 ]
Avatar
Joined: 2011-08-28
136 posts

Hi everyone, I have a problem related to using get_instance after extend my controller from MX_Controller.
I write everything here: http://ellislab.com/forums/viewthread/224908/

Hopefully someone can help me.
Thanks

 Signature 

Homepage : http://www.getnocms.com
Github page : https://github.com/goFrendiAsgard/No-CMS

A free CodeIgniter based CMS-Framework, It is not just another CMS !!!

 
Posted: 26 September 2012 01:27 AM   [ Ignore ]   [ # 280 ]   [ Rating: 0 ]
Joined: 2012-07-13
6 posts

Hello all,

I’m having trouble getting my head around how to do view partials right, without repeating lots of code.

http://ellislab.com/forums/viewthread/224791/

In hindsight, I should’ve posted my problem in here, rather than the code forum.

Any help appreciated.

Thanks!

 
Posted: 04 October 2012 12:48 AM   [ Ignore ]   [ # 281 ]   [ Rating: 0 ]
Joined: 2012-06-09
3 posts

Found a bug in HMVC’s Loader that leads to a “Fatal error: Maximum function nesting level of ‘100’ reached, aborting!”

The error can be reproduced by creating an autoload config file within a module and adding a library to load. Ex:

modules/
..
admin/
....
config/
......
autoload.php
....libraries/
......
admin_controller.php 

The problem was that the ‘_autoloader’ function kept recursively trying to “autoload” the library regardless of whether or not it’s already loaded. This lead to an endless loop where the loaded file (which extends the MX_Controller) called it’s parent controller which in turn tried to ‘initialize’ on every call in which ‘_autoloader’ was called again and again (a recursive result of the infamous ‘goto’).

I solved this by adding a line in the Loader to check if the class was already loaded so it doesn’t recurse itself…

// MX/Loader.php
// line (396-398)?:
// -> replace:
// foreach ($autoload['libraries'] as $library) {
//     $this->library($library);
// }
// -> to:
foreach ($autoload['libraries'as $library{
    
if (class_exists($libraryFALSE)) continue;
    
$this->library($library);


~NS

 
Posted: 04 October 2012 02:38 AM   [ Ignore ]   [ # 282 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-10
2919 posts

The problem occurs because you have incorrectly put a controller into the libraries directory.
I don’t agree that altering any code is required because the library loader already checks for the class so you’re just duplicating code to fix your mistake.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

 
Posted: 04 October 2012 03:40 AM   [ Ignore ]   [ # 283 ]   [ Rating: 0 ]
Joined: 2012-06-09
3 posts
wiredesignz - 04 October 2012 02:38 AM

The problem occurs because you have incorrectly put a controller into the libraries directory.
I don’t agree that altering any code is required because the library loader already checks for the class so you’re just duplicating code to fix your mistake.

Do the modules support extending the core class? or look for the extensions in a special folder where I can place my custom classes to extend the core through a module? Duplicating code to fix my mistake..? I’m sorry, didn’t know you would be offended by a simple solution that makes it easier to extend core..

I know you can add a separate function in HMVC to look into a “core” folder within the module and extend core classes from thereon but I’m a bit lazy so that was sufficient lol.

 
Posted: 04 October 2012 03:55 AM   [ Ignore ]   [ # 284 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-10
2919 posts

I’m not offended at all. Just stating a fact.

CI conventions indicate that controllers and their ancestors provide core functionality they are not defined as libraries.

If you need a base controller you can create a core directory in your module and include the parent class as per your normal PHP directives or place them into the application/core directory to be autoloaded.

Also if you load a base controller as a library then you are instantiating a redundant controller instance which seems pointless.

In future it might be worth looking at the Modules::autoload() method to accommodate loading core files from modules too.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

 
Posted: 04 October 2012 09:09 AM   [ Ignore ]   [ # 285 ]   [ Rating: 0 ]
Joined: 2012-06-09
3 posts
wiredesignz - 04 October 2012 03:55 AM

I’m not offended at all. Just stating a fact.

CI conventions indicate that controllers and their ancestors provide core functionality they are not defined as libraries.

If you need a base controller you can create a core directory in your module and include the parent class as per your normal PHP directives or place them into the application/core directory to be autoloaded.

Also if you load a base controller as a library then you are instantiating a redundant controller instance which seems pointless.

In future it might be worth looking at the Modules::autoload() method to accommodate loading core files from modules too.

Alright awesome then =). I’m new to CI so correct me if I’m wrong. Btw, HMVC is a great addition to CI, I really do like it but of course, stuff needs to be modified when scaling out applications.

Including the parent class as per normal PHP directives defeats the purpose of having the class loaded through the CI system, I’d need to include the class into every controller I make within the module - this is why I wanted to have the class autoloaded since it will be used regardless for all controllers in the module. And placing my extended core classes into core defeats the purpose of individual modularity - and plus, I have other extensions of core classes using the “subclass_prefix.”

The Modules::autoload() function does not go to the depth of /module/module_name/core, but rather stays at application level. I’d need to modify this if I wanted this to look for a core folder within a module.

Just because a core class is placed in a “libraries” folder doesn’t mean that it has to act like a library. Would I rather put it in a folder called “core” for the sake of indicating it is a core class? Yes, I would love to lol.

 
19 of 23
19