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

[eluser]codex[/eluser]
[quote author="wiredesignz" date="1215672412"]For the MY_Controller issue, Make your Admin_Controller and Public_Controller extend Controller not Base_Controller, then add Base_Controller to autoload and call its methods / varaibles as needed, just like a library.

Use application/config/autoload.php :ie $autoload['controllers'] = array('base_controller');

Note: In the latest verison of ME4.2 $autoload['controllers'] is now $autoload['modules'] and ME5.0.27 will be changed to match.

EDIT:
Sorry codex, I didn't notice right away you are using that cascading controller thing. It's a bit difficult for me to advise on this as I would never build an application like that.[/quote]

Ok, so for this moment forget I'm using the cascading style.

I now have a new module 'modules/public/public.php'. In public.php there's
Code:
class Public_Controller extends Controller
     {                                            
        function Public_Controller()
        {
            parent::Controller();
}
}

Added $autoload['modules'] = array('public'); to autoload.

But get this error:
Code:
Fatal error: Class 'Public_Controller' not found in F:\wamp\www\mextensions\application\modules\site\controllers\site.php on line 3

It IS possible to extend your modules from another controller, right?

[eluser]wiredesignz[/eluser]
@codex, The filename and class name must be the same.

It is possible, But I have never tried to extend a module controller from another controller, other than when using module methods.

[eluser]codex[/eluser]
[quote author="wiredesignz" date="1215674381"]@codex, The filename and class name must be the same and the module must have a `controllers` directory.[/quote]

I did that in the first place, but didn't work. Will try again, maybe made a typo or whatever. And there IS a controllers dir, I think I forgot to add it to the url.

EDIT: Yes, typo.

But still getting the error.

Tried $autoload['modules'] = array('public_controller') and $autoload['controllers'] = array('public_controller');

[eluser]codex[/eluser]
Quote:You can use Modular Extensions in exactly the same fashion as Matchbox, without using any of the additional features ME provides.

Well, not EXACTLY. Matchbox handles cascading controllers without issues. (sorry, couldn't resist ;-))

[eluser]wiredesignz[/eluser]
@codex, Is the module named public_controller too, otherwise use the prefix segment public/public_controller

Wether or not Matchbox allows you to use poor coding style is not my concern either (sorry couldn't resist) :lol:

[eluser]codex[/eluser]
[quote author="wiredesignz" date="1215675035"]@codex, Is the module named public_controller too, otherwise use the prefix segment public/public_controller[/quote]

Yes, everything is called public_controller. And I've tried to prefix it too. No cigar.

Maybe I just should look at it tomorrow with fresh eyes. I might be missing something crucial. It's kinda late here.

[eluser]wiredesignz[/eluser]
The ME guide to happiness

1) Start with a clean CI install.
2) Set $config['base_url'] correctly for your installation.
3) Access the URL domain/subdir/index.php/welcome - Welcome to CodeIgniter = happiness!
4) Drop Modular Extensions libraries into application/libraries and application/helpers directories as specified.
5) Access the URL domain/subdir/index.php/welcome - Welcome to CodeIgniter = more happiness!
6) Create module directory structure application/modules/welcome/controllers.
7) Move controller application/welcome.php to application/modules/welcome/controllers/welcome.php.
8) Access the URL domain/subdir/index.php/welcome - Welcome to CodeIgniter = even more happiness!
9) Create directory application/modules/welcome/views.
10) Move view application/views/welcome_message.php to application/modules/welcome/views/welcome_message.php
11) Access the URL domain/subdir/index.php/welcome - Welcome to CodeIgniter = ecstasy!

You now have a running Modular Extensions installation.

[eluser]Sam Dark[/eluser]
codex
Are you trying to use base controller?

I did by inluding it in Controller.php by using include('base_controllers.php').

I know this is not the right way but I didn't found how to it better.

wiredesignz
Good one. Add this guide to the wiki Smile

btw., still can't solve my config issue from the past without editing ME code Sad

[eluser]codex[/eluser]
[quote author="Sam Dark" date="1215698791"]codex
Are you trying to use base controller?

I did by inluding it in Controller.php by using include('base_controllers.php').

I know this is not the right way but I didn't found how to it better.

wiredesignz
Good one. Add this guide to the wiki Smile

btw., still can't solve my config issue from the past without editing ME code Sad[/quote]

Hey Sam, thanks for the advice. I was just thinking about doing it that way and I'm glad you confirmed that it will work that way.

Cheers!

[eluser]wiredesignz[/eluser]
[quote author="Sam Dark" date="1215698791"]btw, still can't solve my config issue from the past without editing ME code Sad[/quote]

@Sam, Please explain the problem loading config files.

I have tested this inside a module controller and it works fine!
Code:
//loads application/config.php to config sub-array
$this->load->config('config', TRUE);




Theme © iAndrew 2016 - Forum software by © MyBB