ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Modular Extensions - HMVC version 5.4

January 29, 2011 1:58am

Subscribe [99]
  • #241 / Apr 22, 2012 8:18pm

    Please add 4 line in config.php then try

    $config['modules_locations'] = array(
            APPPATH.'_backend/'  => '../backend/',
            APPPATH.'_frontend/' => '../frontend/',
        );
  • #242 / Apr 24, 2012 6:21am

    Sven Delle

    64 posts

    @wiredesignz

    May I suggest you put a link on the very first post (erh, maybe on the word ‘bitbucket’) in this thread, that links to HMVC on bitbucket, instead of having us hunt for it?

    Now, that would be nice. And when I think about it - user friendly.

  • #243 / Apr 24, 2012 6:34am

    wiredesignz

    2882 posts

    @Sven Delle, The link is in my signature below, it is visible on more than 3000 posts all around these forums.

  • #244 / Apr 24, 2012 6:52am

    Sven Delle

    64 posts

    You’re absolute right. This just proves to me that vital information (as in related to the post content) shouldn’t go in the signature.

    Do you honestly read all peoples signature when speeding through posts to get information?

    Well, maybe you do. But I sure don’t (and I’d guess, others too).

    And as it is the nature of html to use links, a user often ‘expect’ a link if it’s relevant. And in this case I think it is.

    But in case I owe you an apology - I do apologize : ).

  • #245 / May 06, 2012 12:03pm

    TheDarkITA

    1 posts

    Hi,
    I tried to load a language file in another module in this mode $this->load->language(‘module_name/file_name’); but it doesn’t work. Is there a mode in order to load a language file in another module?

    Thanks

    EDIT: Solved, it’s work

  • #246 / May 14, 2012 5:47am

    rose_anne

    5 posts

    Hi!, is it possible to have two or more controllers in one module.

  • #247 / Jun 02, 2012 11:28am

    madmuffin

    3 posts

    hello, I am supposed to “modularize” an existing project.

    current structure is:

    application/
     + controllers/
        + admin.php (extending MY_Controller)
        + user.php  (extending MY_Controller)
     + core/
        + MY_Controller.php (extending CI_Controller)

    the new structure should look loke this:

    application/
     + controllers/
        + admin.php (extending MY_Controller)
        + user.php  (extending MY_Controller)
     + core/
        + MY_Controller.php (extending CI_Controller)
     + modules/
        + mod1/
           + controllers/
              + mod1.php (extending MX_Controller)

    admin.php should still create the website’s design, propagate a list of avaliable modules, give oppurtinity to “enable/disable” them.

    Unfortunately, when I try to call

    Modules::run('mod1/mod1/function');

    I get an error

    PHP Fatal error:  Class 'Modules' not found in /application/controllers/admin.php on line 50

    Must admin.php also extend MX_Controller? I tried that, but that also gave me an error

    PHP Fatal error:  Class 'MX_Controller' not found in ...


    I would really appreciate any hints!

    (Running CodeIgniter 2.1.0)

    madmuffin

  • #248 / Jun 03, 2012 1:09am

    dmyers

    43 posts

    I am having some issues with prefixing the controller (routing) and HMVC and hopefully someone can help me figure it out.

    I currently have this in my root router.php file

    $route['default_controller'] = "controller_index";
    
    $route['(:any)/(:any)/(:any)/(:any)/(:any)'] = "controller_$1/$2/$3/$4/$5";
    $route['(:any)/(:any)/(:any)/(:any)'] = "controller_$1/$2/$3/$4";
    $route['(:any)/(:any)/(:any)'] = "controller_$1/$2/$3";
    $route['(:any)/(:any)'] = "controller_$1/$2";
    $route['(:any)'] = "controller_$1";

    This allows me to prefix my controllers with controller_something. This way I can keep a library like “maintenance” and a controller like “controller_maintenance” since you don’t normally access controller by name and you access libraries a lot keeping the library name short seemed to be very helpful.

    Unfortunately, This seems to be throwing off the HMVC because it can’t find the mvc controllers with the base routing in place? is this possible? do I need to add it to the modules router.php file?

    Everything with the normal route seems to work pretty good so I seem to have the basic setup right at this point. Things just get wonky when I add my controller prefix stuff.

    Anyone know if/how I can do this as I don’t want to get rid of the “controller_” naming spacing.

    DMyers

  • #249 / Jun 03, 2012 1:59am

    dmyers

    43 posts

    I think I found the answer to my own question above. You seem to have a config setting named controller_suffix. By setting controller_suffix in the root config.php file I am able to tell the Modular Extension all of my controller files end in ####

    $config['controller_suffix'] = '_controller';

    So I just added the above and it can suffix all my controllers! Which is fine with me! (prefix / suffix who cares!)

    Is this “hidden” variable acceptable to use?

  • #250 / Jun 03, 2012 2:08am

    wiredesignz

    2882 posts

    Yes, That’s exactly what the controller suffix is for, although I didn’t think it was a “hidden” variable. 😉

  • #251 / Jun 03, 2012 7:28am

    dmyers

    43 posts

    Yes, That’s exactly what the controller suffix is for, although I didn’t think it was a “hidden” variable. 😉

    I figured I could “hack” your code to add it but I noticed that config setting (hum maybe I should look for others…)

    Now I don’t even need the router stuff!

    Either way it is a excellent piece of code! Thank you for all the great work and continued support! :cheese:

     

  • #252 / Jun 06, 2012 10:08am

    madmuffin

    3 posts

    Bumping this question. Any hints on my issue?

    hello, I am supposed to “modularize” an existing project.

    current structure is:

    application/
     + controllers/
        + admin.php (extending MY_Controller)
        + user.php  (extending MY_Controller)
     + core/
        + MY_Controller.php (extending CI_Controller)

    the new structure should look loke this:

    application/
     + controllers/
        + admin.php (extending MY_Controller)
        + user.php  (extending MY_Controller)
     + core/
        + MY_Controller.php (extending CI_Controller)
     + modules/
        + mod1/
           + controllers/
              + mod1.php (extending MX_Controller)

    admin.php should still create the website’s design, propagate a list of avaliable modules, give oppurtinity to “enable/disable” them.

    Unfortunately, when I try to call

    Modules::run('mod1/mod1/function');

    I get an error

    PHP Fatal error:  Class 'Modules' not found in /application/controllers/admin.php on line 50

    Must admin.php also extend MX_Controller? I tried that, but that also gave me an error

    PHP Fatal error:  Class 'MX_Controller' not found in ...


    I would really appreciate any hints!

    (Running CodeIgniter 2.1.0)

    madmuffin

  • #253 / Jun 06, 2012 7:12pm

    wiredesignz

    2882 posts

    @madmuffin, Your problem has been answered elsewhere in the forums.

  • #254 / Jun 14, 2012 4:57pm

    pyweb1

    11 posts

    hi,

    i am trying to create a module that connect to a different database with a database group and I would like to keep the codeigniter default database config file untouched (the one not in the module)

    what I mean?:

    main_codeigniter_folder/application/config/database.php --> should stay untouched

    i would like to use the file

    main_codeigniter_folder/application/modules/my_db_module/config/database.php

    wich contains:

    $db['my_module_db']['hostname'] = 'localhost';
    $db['my_module_db']['username'] = 'root';
    $db['my_module_db']['password'] = '';
    /.../
    $db['my_module_db']['autoinit'] = TRUE;
    $db['my_module_db']['stricton'] = FALSE;

    So, in the db related model, i use

    class my_db_module_model extends MX_Model{
     // This is the main db related class
     
     private $my_module_db = '';
    
     function __construct(){
      parent::__construct();
      $this->my_module_db = $this->load->database('my_module_db', TRUE);
     }
    
     function get_all_images_info(){
      $query = $this->my_module_db->get('my_db_table_name');
      return ($query->result_array());
     }

    sadly, hmvc don’t load the modular database.php file and give me an error

    You have specified an invalid database connection group.

    So I tried loading the database config file with

    $this->load->config('database');

    and:

    Your application/config/database.php file does not appear to contain a valid configuration array.

    I tried this:

    I rename my database.php to my_module_database.php
    and I tried loading the database config file with

    $this->load->config('my_module_database');

    and:

    Your application/config/database.php file does not appear to contain a valid configuration array.

    so, how do you load a modular database.php config file with hmvc and use a database connection group?

  • #255 / Jun 14, 2012 5:23pm

    wiredesignz

    2882 posts

    //application/modules/my_module/config/database.php
    $config['my_module_db']['hostname'] = 'localhost';
    $config['my_module_db']['username'] = 'root';
    $config['my_module_db']['password'] = '';
    //...
    $config['my_module_db']['autoinit'] = TRUE;
    $config['my_module_db']['stricton'] = FALSE;
    
    $this->config->load('my_module/database', TRUE);
    
    $my_module_db_params = $this->config->item('my_module_db');
    
    $this->db = $this->load->database($my_module_db_params, TRUE);

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases