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]
  • #181 / Nov 23, 2011 7:51pm

    haydenp

    46 posts

    A BUG ... or is it correct in doing this?

    CI: 2.0.3
    HMVC: 5.4

    Folder Structure:

    root
    —application
    ——modules
    ———entries (module name)
    ————entries.php (controller name)

    The entries.php controller

    Inside my entries.php controller there is only the index method

    /**
     * index
     *
     * @return void
     */
    public function index($id = 0)
    {
        echo '<h1>SHOW ENTRY ID: '.$id.'</h1>';
    }

    This url will throw a 404

    mywebsite.com/entries/id-1

    As the Controller name matches the Module name and the Index method is what I am looking to call, should the above work or is it correct in throwing the 404 and routing is required for this scenario?

    For example:

    $route['entries/(:any)'] = 'entries/index/$1';

    Adding the above route resolves the issue, but I would have thought routing was not needed at all?

  • #182 / Nov 24, 2011 12:19am

    wiredesignz

    2882 posts

    @haydenp, If your URL works with a controller in the application directory without requiring routing, it should also work for a module controller with Modular Extensions HMVC.

  • #183 / Nov 24, 2011 6:09am

    haydenp

    46 posts

    @wiredesignz Thanks for the prompt reply!

    I have just done a clean install (CI: 2.1.0, HMVC: 5.4). I followed the instructions as per BitBucket and everything works a treat.

    To test, I made one small change (added the $id parameter) to the INDEX method in the welcome.php controller. See below.

    public function index($id)
    {
        $this->load->view('welcome_message');
    }

    TEST URLS

    http://localhost/hmvc.5.4/index.php/welcome

    This works but (as expected) tells me that I am missing a parameter. Message: Missing argument 1 for Welcome::index()

    http://localhost/hmvc.5.4/index.php/welcome/ID-100

    This throws a 404!

    Any ideas? Or is this the correct behavior, leaving 2 options:

    Add routing OR use a _remap() as per this solution: http://ellislab.com/forums/viewthread/135187/#668213

     

     

  • #184 / Nov 24, 2011 9:46pm

    khavayero

    14 posts

    Hello,

    first of all, congratulations for your hard work! HMVC is great!

    I have a problem with the file application/config/autoload.php

    If I create the file my_module/config/autoload.php and assign a value to the variable $autoload[‘packages’] within the module, it works correctly.

    But if the file application/config/autoload.php assign a value to the variable $autoload[‘packages’] not working. Why?

    Thanks in advance!

  • #185 / Nov 25, 2011 12:29am

    wiredesignz

    2882 posts

    @khavayero, Modular Extensions HMVC does not support packages in modules. Is there a reason that it should?

  • #186 / Dec 02, 2011 9:56am

    har386

    4 posts

    CI 2.1.0 and latest HMVC from bitbucket, all fresh.

    Structure:

    application/modules/hello/controllers/hello.php
    application/modules/world/controllers/world.php
    application/modules/helloworld/controllers/helloworld.php

    Contents of hello.php:

    <?php
    class hello extends MX_Controller {
        public function index() {
           echo('hello');
        }
    }

    Contents of world.php:

    <?php
    class world extends MX_Controller {
        public function index() {
           echo('world');
        }
    }

    Contents of helloworld.php:

    <?php
    class helloworld extends MX_Controller {
        public function index() {
            modules::run('hello');
            modules::run('world');
        }
    }

    index.php/hello and index.php/world work as expected.

    index.php/helloword is blank page.

    Relevant log with log_threshold = 2:

    DEBUG - 2011-12-02 06:53:50 --> Controller Class Initialized
    DEBUG - 2011-12-02 06:53:50 --> helloworld MX_Controller Initialized
    DEBUG - 2011-12-02 06:53:50 --> Loader Class Initialized
    DEBUG - 2011-12-02 06:53:50 --> Unable to locate the config/ file: constants.php
    DEBUG - 2011-12-02 06:53:50 --> Unable to locate the config/ file: autoload.php
    DEBUG - 2011-12-02 06:53:50 --> Unable to locate the config/ file: routes.php
    DEBUG - 2011-12-02 06:53:50 --> File loaded: application/controllers/../modules/hello/controllers/hello.php
    DEBUG - 2011-12-02 06:53:50 --> hello MX_Controller Initialized
    DEBUG - 2011-12-02 06:53:50 --> Loader Class Initialized
    DEBUG - 2011-12-02 06:53:50 --> Unable to locate the config/ file: constants.php
    DEBUG - 2011-12-02 06:53:50 --> Unable to locate the config/ file: autoload.php
    DEBUG - 2011-12-02 06:53:50 --> Unable to locate the config/ file: routes.php
    DEBUG - 2011-12-02 06:53:50 --> File loaded: application/controllers/../modules/world/controllers/world.php
    DEBUG - 2011-12-02 06:53:50 --> world MX_Controller Initialized
    DEBUG - 2011-12-02 06:53:50 --> Loader Class Initialized
    DEBUG - 2011-12-02 06:53:50 --> Unable to locate the config/ file: constants.php
    DEBUG - 2011-12-02 06:53:50 --> Unable to locate the config/ file: autoload.php
    DEBUG - 2011-12-02 06:53:50 --> Final output sent to browser
  • #187 / Dec 02, 2011 10:05am

    PhilTem

    872 posts

    I’d say you need the constructor called for all controllers you have. Otherwise it were most likely to not work.

    <?php
    class hello extends MX_Controller {
        
        public function __construct()
        {
            parent::__construct();
        }
        
        public function index()
        {
            echo('hello');
        }
    }

    same for helloworld and world respectively

  • #188 / Dec 02, 2011 10:30am

    har386

    4 posts

    I’d say you need the constructor called for all controllers you have. Otherwise it were most likely to not work.

    Doesn’t work. (I actually cut those out for clarity here).

  • #189 / Dec 02, 2011 5:08pm

    wiredesignz

    2882 posts

    @PhilTem, You don’t need to use empty constructors.

    @har386, Output from your module controllers via modules::run() will be buffered and returned, but your code in the calling controller is not doing anything with the output.

  • #190 / Dec 02, 2011 5:44pm

    har386

    4 posts

    @har386, Output from your module controllers via modules::run() will be buffered and returned, but your code in the calling controller is not doing anything with the output.

    What’s the correct way of making this simple helloworld work and what’s up with the debug log (Unable to locate the config/ ..etc)?

    Thanks.

  • #191 / Dec 03, 2011 5:12am

    Valhallen

    10 posts

    any clue on how to get CI’s profiler to work with HMVC?

    it displays some stuff but not the queries and throws an error

    A PHP Error was encountered
    
    Severity: Notice
    
    Message: Undefined property: Content::$profiler
    
    Filename: MX/Loader.php
    
    Line Number: 165
    
    Backtrace:
    
    File: C:\www\my_really_awesome_website\application\third_party\MX\Loader.php
    Line: 165
    Function: _exception_handler
    
    File: C:\www\my_really_awesome_website\index.php
    Line: 260
    Function: require_once
  • #192 / Dec 05, 2011 10:14am

    Garf Orlock

    5 posts

    Has anyone been able to integrate codeigniter 2 with doctrine and HMVC ?

  • #193 / Dec 05, 2011 10:32am

    donjim

    7 posts

    Why cant i load module/config/database.php
    with $this->load->database(); in module controller?

    Is it supposed to work?

  • #194 / Dec 05, 2011 1:42pm

    wiredesignz

    2882 posts

    Why cant i load module/config/database.php
    with $this->load->database(); in module controller?

    Is it supposed to work?

    It does work.
    Show some code or explain your problem in more detail.

  • #195 / Dec 08, 2011 4:30am

    kasakka

    2 posts

    How do I extend a controller inside a module?

    Let’s say I have a controller called Auth. I want to extend it with controller Auth_custom

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Auth_custom extends Auth {
    
     public function __construct() {
      parent::__construct();
     }
    
     public function custom($params = false) {
      echo 'I am custom';
     }
    }
    ?>

    However, when I try to access Auth_custom by going to modulename/auth_custom/custom for example it just says that it can’t find the Auth class. Do I have to load Auth first somewhere else or am I doing this completely wrong?

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

ExpressionEngine News!

#eecms, #events, #releases