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]
  • #151 / Nov 02, 2011 12:20pm

    Tanver

    29 posts

    @wiredesignz, Unfortunately it did not worked, I installed it correctly was able to access the client side but unable to go past the login screen for the admincp. The username and passwords are correct, no error message is displayed either and I always end-up on the same login page :(.
    The other thing I have noticed about this solution is that it is an hybrid [CI, Smarty] kind of a solution where I would like to be with a pure CI stuff.

  • #152 / Nov 02, 2011 12:29pm

    trangman

    2 posts

    @wiredesignz
    Thanks, am just looking at it.

    Sorry a bit confusing with other posts, I’m trying to get autoload to work with HMVC and Sparks.

    Okay having re-read the whole thread I see the problem was solved further up by adding the Spark Autoload code into the MX MY_Loader. So all working now.

    Thanks for all your work.

  • #153 / Nov 05, 2011 9:16am

    ronyisme

    3 posts

    Fatal error: Cannot redeclare class CI in C:\xampp\htdocs\ci_lelang\application\third_party\MX\Base.php on line 57

    Anyone know about this error?

     

  • #154 / Nov 05, 2011 6:46pm

    wiredesignz

    2882 posts

    Post your version number for Modular Extensions HMVC and show the code from MX/Base.php line 57.

    Also post the code for the controller you are calling from the URL.

  • #155 / Nov 06, 2011 7:51am

    ronyisme

    3 posts

    Post your version number for Modular Extensions HMVC and show the code from MX/Base.php line 57.

    Also post the code for the controller you are calling from the URL.

    I’m using hmvc ver 5.4, here the code from MX/Base.php.

    class CI extends CI_Controller
    {
     public static $APP;
     
     public function __construct() {
      
      /* assign the application instance */
      self::$APP = $this;
      
      global $LANG, $CFG;
      
      /* re-assign language and config for modules */
      if ( ! is_a($LANG, 'MX_Lang')) $LANG = new MX_Lang;
      if ( ! is_a($CFG, 'MX_Config')) $CFG = new MX_Config;
      
      parent::__construct();
     }
    } [b]//This is line 57 in my editor[/b]
    
    /* create the application object */
    new CI;

    I try to call a function from a view file,

    <?php if (modules::run('login/is_logged_in') == FALSE) : ?>
    <li><?php echo anchor('member/register','Register'); ?></li>
    
    <li><?php echo anchor('member/login','Login'); ?></li>
    <?php endeif; ?>

    and here is some part of the controller (modules/controllers/login/login.php,

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class Login extends MX_Controller{
     public function __construct()
     {
      parent::__construct(); 
      $this->load->library('session'); 
     }
     public function is_logged_in()
     {
      $login = $this->session->userdata('login');
      if($login == TRUE)
      {
       return TRUE;
      }
      else 
      {
       return FALSE;
      }
     }
    }

     

     

  • #156 / Nov 06, 2011 1:49pm

    wiredesignz

    2882 posts

    Also post the code for the controller you are calling from the URL.

  • #157 / Nov 06, 2011 9:55pm

    ronyisme

    3 posts

    @wiredesignz, thanks for your guidance, i found the problem. I forgot to add MX_Controller in controller that i call.

  • #158 / Nov 07, 2011 2:05pm

    ircdirk

    1 posts

    Ok, here is my problem i have controller:

    class Admin extends CI_Controller {
    
    ...
    
    function logged() {
      $module = $this->load->module('sections');
      $module->admin();
    }
    
    }

    then i have module

    class Sections extends CI_Controller {
    
     function __construct()
     {
      parent::__construct();
     }
      
     public function admin()
     {
      $query = $this->db->get('sections');

    and on this point i got Error:

    A PHP Error was encountered
    
    Severity: Notice
    
    Message: Undefined property: Sections::$db
    
    Filename: controllers/sections.php
    
    Line Number: 20

    why cant i access autoloaded library from this module???

    (i have tried to load database library from module but got same error)

  • #159 / Nov 10, 2011 11:11am

    Miguel Ramos

    4 posts

    Hey guys. I have been playing a while with hmvc and many thanks to wiredesignz for this tweak. It gaves power to CI. My post is I’ve tried to implement Sparks+Hmvc and having some errors when MY_Controller file is present in core and to load a spark from a Controller that extends from MX_Controller or MY_Controller. First after install hmvc run welcome controller that extends from CI_Controller and this is the default welcome from CI. With the presence o MY_Controller file it gaves me error:

    A PHP Error was encountered
    
    Severity: Notice
    
    Message: Undefined property: Welcome::$example_spark
    
    Filename: controllers/welcome.php
    
    Line Number: 24

    If MY_Controller file isn’t present it runs normal. Second, calling from a module it gaves me class example/1.0.0 not found.
    I’ve hmvc 5.4+CI2.0.3 and the latest spark manager. In my debugs i’ve saw that in CI object when changing $this->_module it applys to current $this (MX_Load) but on CI::$APP->load->_model it stay the test module and when autoload from MX_Loader run it gaves the current module and not the spark that have been defined in $this->_module = $spark.

    Could you guys point me the best solution for this? I read changing the sparks autoload but how to?

    Many thanks to all. Keep the good working.

  • #160 / Nov 15, 2011 10:34pm

    mikelexp

    9 posts

    Form_validation callbacks are broken with CI 2.1.0, because we’re no longer allowed to do this:

    $this->form_validation->CI =& $this;

    Changing the CI variable declaration in Form_validation.php from protected to public fixes it, but I wonder if it’s possible to fix HMVC instead, because it would be better not to patch CI’s core (even though I’m already doing it so I can run DataMapper with CI 2.0.3).

  • #161 / Nov 16, 2011 12:53am

    wiredesignz

    2882 posts

    A simple fix is to extend the CI_Form_validation class.

    class MY_Form_validation extends CI_Form_validation 
    {
        public $CI;
    }
    
    /** application/libraries/MY_Form_validation **/
  • #162 / Nov 16, 2011 2:39am

    Kobus M

    54 posts

    Hi guys,

    I hope this is nothing trivial, but I am really unable to get HMVC work the way I intend it to work, however, I am not sure if I am trying to do it the right way.

    I have installed the extension successfully, have a folder called modules, and the following structure:

    modules
    —-admin
    ———user
    ————-controllers
    ————-models
    ————-views
    ———core
    ————-controllers
    ————-models
    ————-views
    —-survey
    ———controllers
    ———models
    ———views
    —-user
    ———controllers
    ———models
    ———views

    The intention for this is to be able to have a front-end user module and an admin user module, and I was expecting to access it as follows:

    http://localhost/index.php/<module>/<controller>/<method&gt;, for example, for the front-end user module, http://localhost/index.php/user/user/login. From the documentation, if the module and controller has the same name, I can leave it out, so I am actually using http://localhost/index.php/user/login and this works perfectly for the front-end modules.

    My problem is with the back-end (or admin) modules which are in a separate folder, and I was expecting to access it as follows: http://localhost/admin/user/manage_users or similar. This does not work :-(

    I do not have any special routing or configuration settings, perhaps I should add routes, or how do I go about this?

    Thanks in advance,

    Kobus

  • #163 / Nov 16, 2011 2:45am

    wiredesignz

    2882 posts

    Try modules/admin/controllers/user/... and modules/user/controllers/... for backend and frontend directory structure respectively.

  • #164 / Nov 16, 2011 6:17am

    Kobus M

    54 posts

    Hi,

    Thank you for the quick response.

    I will play around with your suggestion when I have access to my code tonight - thanks in advance!

    Kobus

  • #165 / Nov 16, 2011 6:28am

    Kobus M

    54 posts

    Hi,

    Thank you for the quick response.

    I will play around with your suggestion when I have access to my code tonight - thanks in advance!

    Kobus

    Hi again,

    From the proposed solution, it seems that it would mean that I can not just copy a folder and drop it into another site to get that module into that site then?

    I was hoping to eventually for each module (front-end and back-end) have their own folders for CSS, scripts, images, etc., if needed.

    I understand that including these files separately for each module does send more http requests and is not best practice, and is therefore making the page slow, but I really want to ensure that a module is literally drag and drop, and then running the install() method creates the database table schema and default values. My process for installing a module should ideally be simple:

    1. Copy folder (e.g. /modules/admin/poll/*.*) into a new site’s corresponding folder.
    2. Log in with admin privileges to the new site.
    3. Run /modules/admin/poll/install on the new site, to create the table structure for polls on the new site, give the default access (via SQL, etc.).

    This module should now be working with the new site. In short, it is a very Drupal’ish approach to permissions management. All I should now do is give the necessary permissions.

    If you have a suggestion to achieve this, it would be awesome.

    Thanks

    Kobus

     

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

ExpressionEngine News!

#eecms, #events, #releases