Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - HMVC version 5.3

[eluser]Bainzy[/eluser]
Boris ... this is the exact reason why i chose to use it myself ... in the past i have always coded in a modular style folder setup ... but sometimes even that falls short. What i wanted to do this type with my forums is have everything so like you say if i changed my users module ( handles all things user related .. profile, settings etc ) i could just release the module as a update .... upload it ... run a installer and have it update the site ... makes everything nice and simple.

[eluser]wiredesignz[/eluser]
[quote author="ralf57" date="1286311218"]
In my opinion a view should only contain the final output and "helpers" calls and should not load any data[/quote]

If you look at CI documentation they often load a view from within another view.

But nowhere does it state in the CI docs or HMVC wiki that you are forced to load views this way.

[eluser]ralf57[/eluser]
[quote author="Boris Strahija" date="1286313587"]I think the biggest advantage is organizing your code into modules. ...[/quote]

I also like to keep things organized in modules but this is different from using the HMVC "features".
In fact you can have modules (Modules Separation) without HMVC.
Fans of the HMVC pattern often bring the "widget problem" as a key argument basically assigning the view a role that it should not have.
As an example,provided a "latest_news.php" view:

Code:
modules::run('content/news/latest', $param);

1) you still have to pass $param if you want to customize the results
2) you introduce some logic in the view, defeating the nice separation provided by the MVC pattern

Not a big deal, in my opinion

[eluser]ralf57[/eluser]
[quote author="wiredesignz" date="1286329528"]
But nowhere does it state in the CI docs or HMVC wiki that you are forced to load views this way.[/quote]

You're right, but apart from this usage (calling a module from a view) I can't find any other big advantage over the standard MVC approach.
If you have some examples of what cannot be achieved without the HMVC, please post them here.
Just to clarify, I don't have anything against HMVC, I am only trying to understand it a bit more

[eluser]asylmottaket[/eluser]
Suggestion:

$this->load->module('module/controller', 'new_name');

$this->new_name->method();


Just like the alias on models

[eluser]Unknown[/eluser]
I'm in the process of transitioning from Modular Separation to Modular Extensions, and it seems I've lost the ability to do 2 things I had grown accustomed to. I'm trying to determine whether I lost them because of some error on my code, or whether they are simply not supported.

1. In MS, I was doing stuff like ...
application/config/autoload.php
application/modules/example_module/config/autoload.php
... and the module had access to anything loaded in either place.

2. In MS, if I had ...
application/modules/example/controllers/example.php
application/modules/example/config/example.php
... the latter was autoloaded.

Thanks in advance.

[eluser]Vheissu[/eluser]
I'm having an issue getting config files inside of my modules to be recognised.

I have a module called 'auth' inside of my application/modules folder. Inside of that I have a config folder and in the config folder I have a config file called 'ion_auth.php' I am basically trying to add Ion_auth into a module.

Inside the Ion_auth library file a new instance of CI is being stored by $this->ci = &get;_instance(); and then config files for Ion_auth are loaded like this:

Code:
$this->ci->load->config('auth/ion_auth', TRUE);

Auth is the name of my module and it should be working, but doesn't appear to be. Even without adding in Auth part it still doesn't find the config file and I get the below error:

The configuration file auth/ion_auth.php does not exist.

I noticed that PyroCMS uses Ion_auth inside of a module called users and it appears to work fine, but I also noticed that Phil has made some tweaks, combined the MX files from Modular Extensions into the one class, so I'm not sure if further modification is required to get config files inside modules loading.

Any help? I'm using Codeigniter 2 (latest version from BitBucket).

[eluser]Phil Sturgeon[/eluser]
[quote author="Vheissu" date="1286956870"]I'm having an issue getting config files inside of my modules to be recognised.

I have a module called 'auth' inside of my application/modules folder. Inside of that I have a config folder and in the config folder I have a config file called 'ion_auth.php' I am basically trying to add Ion_auth into a module.

Inside the Ion_auth library file a new instance of CI is being stored by $this->ci = &get;_instance(); and then config files for Ion_auth are loaded like this:

Code:
$this->ci->load->config('auth/ion_auth', TRUE);

Auth is the name of my module and it should be working, but doesn't appear to be. Even without adding in Auth part it still doesn't find the config file and I get the below error:

The configuration file auth/ion_auth.php does not exist.

I noticed that PyroCMS uses Ion_auth inside of a module called users and it appears to work fine, but I also noticed that Phil has made some tweaks, combined the MX files from Modular Extensions into the one class, so I'm not sure if further modification is required to get config files inside modules loading.

Any help? I'm using Codeigniter 2 (latest version from BitBucket).[/quote]

Heh I haven't made any tweaks, PyroCMS is still using my old fork of Modular Separation which is now part of Modular Extensions again.

[eluser]Vheissu[/eluser]
Oh, I see. I guess I am just presuming that you modified something because the core files are combined into the one class in your CMS. I still can't work out what is going on, so I'll provide some extra detail in the hopes that someone can assist me.

Here is MY_Controller:

Code:
require APPPATH."third_party/MX/Controller.php";

class MY_Controller extends MX_Controller {
    
    public $CMS;
    
    // Setting variables
    public $settings = array();
        
    public function __construct()
    {
        // Constructor
        parent::__construct();
        
        // Get instance of Codeigniter object
        $this->CMS = &get;_instance();
        
        // Gets settings from database
        $this->_init_settings();
                
    }
    
    // Gets settings from database and stores them
    public function _init_settings()
    {
        $settings = $this->db->get('settings');
    
        foreach ($settings->result_array() as $row)
        {
            // go through the settings table and pull out lots of stuff
            $this->config->set_item($row['setting_name'], $row['setting_value']);
            
            // set MY_Controller variables (to save function class to config)
            $this->settings[$row['setting_name']] = $row['setting_value'];
        }    
    }
    
}

I have MY_Controller, MY_Loader and MY_Router inside of the core directory inside of my application directory. In my libraries folder I have Dwoo and MY_Router (same code you posted on your blog Phil) for using Dwoo with the Codeigniter parser.

Inside of my auth module I have the following directories and files:

Auth
Config
ion_auth.php
Controllers
auth.php
Language
(a whole heap of language directories for multiple languages from Ion Auth)
Libraries
Ion_auth.php
Models
ion_auth_model.php
Views
(just the views that come within the download Ion auth package)

In my application/config/routes.php file I have the following code:

Code:
$route['default_controller'] = "pages/pages";    // Pages controller is the default controller
$route['admin']              = "admin";          // Main admin controller
$route['(:any)/admin']       = "$1/admin";       // Individual module admin controllers
$route['(:any)']             = "pages/pages/$1"; // Every request to the pages controller

If there is anything else I can supply, please let me know. I would really like to get config files in my modules to load. Is there perhaps another hacky way like including the config file if I can't get it to work and nobody can help me?

Thank you.

[eluser]Unknown[/eluser]
Hi to all!

I'm using CodeIniter 2 with Modular Extensions and I have a question. Is there any intelligent way to deny access to module controllers by URL? So it will be accessible only from other controllers.

I can use unserscore in function names (_myFunction) but maybe there is another predefined in ME way?

Thanks a lot!




Theme © iAndrew 2016 - Forum software by © MyBB