Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - Version 4.3

[eluser]wiredesignz[/eluser]
Version 4.0.30 (final) of Modular Extensions HMVC is available on the wiki along with the new Modular Extensions Version 4.1.04.

[eluser]dmitrybelyakov[/eluser]
Hello,

I'm still in the process of checking this but seems like I cannot load helper files located in subfolders under /application/helpers/ when using your Controller.php from ME 4.1 distribution.

So when i use this in my default controller:
Code:
$this->load->helper("subfolder/helper");

I get a not found error. Disabling your Controller.php seems to solve this issue.

Just to let you know. Thanks again for your work.

[eluser]wiredesignz[/eluser]
The idea is to create a module for each controller and not use sub-directories.

If you have application/controllers/welcome.php, you create a module directory, application/modules/welcome/helpers/ and put helper there.

If the helper is shared then you just use application/helpers/

[eluser]dmitrybelyakov[/eluser]
Yes, i understand. The reason why i want to this is simple: my application uses a number of libraries and helpers along with HMVC modules. All helpers are then stored in /application/helpers/cmscore/. These ones do not refer directly to any particular module and are required for the application to operate.

Of course i can change my folder structure & modify all files i've written so far, but i just don't see any reason to do it since CI allows us to have helpers in subfolders.

Thanks again for your time )

EDIT: I think i'll stick to 4.0 versions for now & see how things are going with 4.1 release.

[eluser]Maxximus[/eluser]
When I try to use validation in a module, the behaviour between 4.0.29 and 4.0.30 seems to have changed. The module is called by a method in another module. Had to autoload Validation in 4.0.30, before it was possible in the module itself.

Validation output is not correct either, using $this->validate->field gives unexpected results (0 values).

What I use is this:
Code:
in /application/modules/amoduleclass/controllers/amoduleclass.php
class Amoduleclass extends Module {

   function __construct() {
      parent::Module();
      $this->load->model('m_search', 'search');
   }

   function ...
}

in /application/modules/amoduleclass/methods/mymethod.php:
class Mymethod extends Amoduleclass {

   function __construct() {  // <== empty, tried several different options.
   }
...
   function somefunction() {
      echo modules::run('anotherfunction', $this->uri->rsegment(6), 'aForm');
   }

   function _output($output) {     // <== tried with and without this function
      echo $output;
   }
}

in /application/modules/othermoduleclass/controllers/othermoduleclass.php
class Othermoduleclass extends Module {
    
   function __construct() {
      parent::Module();
      $this->load->model('m_modelx', 'modelx');
      $this->load->library('validation');   //<=== Will error, needs to be autoloaded
   }

   function aForm($input) {
      $rules['email'] = "trim|required|valid_email";
      $this->validation->set_rules($rules);               // <== Will error

   }
}
Did not try all this with the new 4.1.x branch, some other issues there at this moment.

Anyone have an idea where I go wrong?

[eluser]wiredesignz[/eluser]
Version 4.0.15 of new Modular Extensions is available on the wiki.

Would appreciate if a few people could try it out.

Added features include:

Application/controllers can own a module with the same name, and its related files would be located in the module.

Modules can also contain controllers with related files in the module.

Module controllers will autoload files from its module/config/autoload.php file as well as application/config/autoload.php

Views can be in module/views/subfolders named to match controllers.

[eluser]wiredesignz[/eluser]
@Maxximus,
Drop the following code into modular_extensions.php at line 253, See if it makes a difference
Code:
if ($path === FALSE)
{
    parent::library($library, $params);
          
    $this->_me->_assign_libraries();
          
    return;
}
Post back with the results. Thanks.

[eluser]Maxximus[/eluser]
okay, library include is good now! Thanks. Still have an issue with the return values (the values return empty), but this is my first time with CI, so it can be me.
Code:
...
   function aForm($input) {
      $rules['email'] = "trim|required|valid_email";
      $this->validation->set_rules($rules);               // <== OK now
      
      $fields['email'] = "Email address";
      $this->validation->set_fields($fields);

      $data = $this->modelx->getData();

      if ($this->validation->run() == FALSE) {
         $view = $this->load->view('p_form', $data);
      } else {
         $view = $this->load->view('p_form_success', $data);
      }
      $this->render($view);
   }

   function render($data, $cache = FALSE) {
      $this->output->cache($cache);
      echo $data;
   }
...
The validation->run() works as expected and generated errors will use the value set in set_fields(), but the $this->validation->email in a view is always empty (in initial state as well as in error state).

[eluser]Maxximus[/eluser]
EDIT:SOLVED! My bad... validate must be validation....Wink

[eluser]wiredesignz[/eluser]
Version 4.0.31 (bugfix above) is available on the wiki.




Theme © iAndrew 2016 - Forum software by © MyBB