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

[eluser]dpgtfc[/eluser]
Just testing out a nav module and can't get the simplest of things to work:

Code:
echo $this->module('nav')->public_nav('1')


The above is in my test controller and this is all it does. The public_nav controller is basically just pulls the navigation from a database and echos it out.

This is the error I get:

Quote:Call to undefined method Chapter::module() etc, etc,

Why doesn't the method chaining work? For that matter, none of the methods mentioned on page 7 of this thread work for me.

Edit:

I got it to work with this:

Code:
$this->load->module('nav');
        echo $this->nav->public_nav('1');

Still can't get the method chaining to work though.

[eluser]wiredesignz[/eluser]
[quote author="Johan André" date="1228425742"]How do I load a model from another module?...
...Any ideas?[/quote]

You can load the module controller and use it to access it's own models
Code:
$data = modules::load('module')->get();

//or

$data = $this->load->module('module')->get();

Or a further option is to extend the Loader class and modify the model loader as you need.
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Modular Extensions loader class extension
*
* install this file as application/libraries/MX_Loader.php
*
**/
class MX_Loader extends Loader
{
    public function model()
    {
        ....
    }
}

[eluser]wiredesignz[/eluser]
[quote author="dpgtfc" date="1228467813"]Just testing out a nav module and can't get the simplest of things to work:

Code:
echo $this->module('nav')->public_nav('1')


[/quote]

Try this:
Code:
echo $this->load->module('nav')->public_nav('1')

[eluser]dpgtfc[/eluser]
[quote author="wiredesignz" date="1228475481"][quote author="dpgtfc" date="1228467813"]Just testing out a nav module and can't get the simplest of things to work:

Code:
echo $this->module('nav')->public_nav('1')


[/quote]

Try this:
Code:
echo $this->load->module('nav')->public_nav('1')
[/quote]

Thanks!

[eluser]tdktank59[/eluser]
We found an error while using DX_Auth.

This seemed to fix it, so thought id post it here for you to look at.

[quote author="RHAngel" date="1228876976"]Error is in HMVC config loader function. "config" function put config to section by default, and you can't change $use_sections variable when loading global config.

Replace in Controller.php:
Code:
if ($path === FALSE)
{
   self::$loader->config($file, TRUE);                    
   return $ci->config->item($file);
}
->
Code:
if ($path === FALSE)
{
   self::$loader->config($file, $use_sections);                    
   return $ci->config->item($file);
}

In this case config loading in DX_Auth will work good.
Sorry for my stupid english Smile[/quote]

[eluser]bugboy[/eluser]
EDIT [ sorted answer at the bottom]

[quote author="Sam Dark" date="1225760383"]Useful contribution for MY_Router.
Initial idea by -=ZaRaZa=-.

What's it adds
It adds ability to add routes from within routes.php config located in your module. Global routes.php is still the boss allowing to remap default routes defined in your modules.

Code
Code:
function _set_routing()
{
  //All code below is a copy-paste from CI_Router.
        
  // Load routes from ME modules
  $modules = dir(MODBASE);
  while (false !== ($module = $modules->read())) {
    if($module != '.' && $module != '..'){
      @include(MODBASE.$module.'/config/routes'.EXT);
    }          
  }
  $modules->close();
  
  //End of code addition
  //Following code is a copy-paste from CI_Router.
        
  // Load the routes.php file.
  @include(APPPATH.'config/routes'.EXT);

  //etc.

Hope this will make it's way into ME.[/quote]


IVe downloaded and installed the ME into my system and it works great the above code looks like it will do what i want however i can't seem to find the place to put it into the My_Router.php file.

I'm using the php5 version


SORTED

Just copy the _set_routing() function from CI Router and past it into My_Router Replacing the first part with the above code.

[eluser]opel[/eluser]
nice mod like Djando app urls

[eluser]opel[/eluser]
with these loader extensions is there a way I can load my modules into a generic view, a suggestion I had was to make a front module and load in other files but I think I am repeating myself?

each of my modules have mvc with the view having styles for a certain method e.g. lists, articles etc. I would like those views to be loaded into a container somehow in a global template?

Can anyone help or suggest how they do it please?

[eluser]spyro[/eluser]
Is there any thorough documentation on how to use routes properly with HMVC? I tried adding the _set_routing code in prior replies but that gave me this error:
Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.

[eluser]woopsicle[/eluser]
i posted this in the wiki-thread but this thread might get a bit more views.

one quick question. i would like my modules to have the possibility of being entirely self contained, including their own images and css files.

if i have a module structure like:

Code:
+ application
    + modules
        + test
          + controllers
          + views
            header.php
           styles.css (css file)

How would I reference that css file in the header.php file?

url.com/test/styles.css doesn't work as I expected it to.

I have tried all sorts of combination's without any luck.




Theme © iAndrew 2016 - Forum software by © MyBB