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

[eluser]wiredesignz[/eluser]
@Edwin, Check out these items,

Class names must have Upper case first character as per the CI user guide.

The script that crashes your server most likely contains an infinite loop or something similar.

If you use ME 4.3 where do you load the base controller?

There is a parser class for use with Modular Extensions on the wiki.

[eluser]edwin87[/eluser]
That's true with class names. It was a writing fault in my post, sorry.

I've tried different options with loading the base_controller.

I've tried it to include it in the Controller library.

Also tried to include the file in the module.
Like:

Code:
<?php
// Load base controller
include(APPPATH . 'controllers/base_controller.php');

class Profile extends Base_controller {

    function Profile()
    {
        parent::Base_controller();
        }
}?>

I need the base controller to load different menus from the database and to set the site language and more things, like meta tags..

I like this the most because it's less writing and scripts are very clean.

But this doesn't work if i load it in the module. So it's true that it is getting stuck in a loop but how can i fix this?

Thanks..

[eluser]wiredesignz[/eluser]
Your base controller should be placed in application/libraries rather than a controllers because it is always extended and never used as a controller itself.

Your "include" will cause problems, you may not include the same class more than once in PHP so will error if the include code is the same in another controller.

[eluser]Mikey McCorry[/eluser]
wiredesignz, was there any solution for the question in my last post, re: being able to extend an application/libraries/mylib.php with application/libraries/MY_mylib.php or am I barking up the wrong tree?

My situation is that I'm currently using Matchbox/Wick to implement modules in my new app. I'm having trouble getting the Wick library to call one module's controller from another one and also to just return the controller instead of outputting it. I'm hoping that ME will solve this for me and remove the need for two libraries.

However, I'm also using Colin Williams' Template library, and have extended it with some extra functionality via a MY_Template.php file. This doesn't seem to work with the latest ME you've posted. Is this possible or a limitation of your library? Thanks again for the help.

[eluser]edwin87[/eluser]
Hello Wiredesignz,

Thanks for your reply.
I've changed the code and put into a library. Your right about that.
Now i am autoloading this library, is this good?

But when i want to load a module in the base_controller, example:
Code:
if($this->session->userdata('user_logged') == 1)
{
   $this->data['profile_settings']     =    modules::run('profile/profile_settings');

}else{

   $this->data['profile_settings'] = NULL;

}

In all modules i extends it with the base_controller.
Code:
class Profile extends Base_Controller

This is cause i want to load my main menu and other things always in the base_controller so i don't have to do it multiple in my files.


So i want to load a module in the url : www.example.com/profile.html and to load some functions in the base controller.


When i do that, it is starting a loop and never gonna get out of it.

I've tried to do it with sessions. So i've a file is loaded it wont load it again. This didn't does the trick, so i hope you can help me (again ;-) )

[eluser]wiredesignz[/eluser]
@Edwin,

Auto loading your base class is not good.

Please use require_once APPPATH.'libraries/Base_Controller.php'; in each of your controller classes, and ensure the class name AND file name is actually Base_Controller.

[eluser]edwin87[/eluser]
Thanks for your quick reply!

I've updated the files but it still looping and eventually i get a memory leak.
Maybe you could post a simple example?

[eluser]wiredesignz[/eluser]
@Edwin, You cannot run a module controller that extends from a base controller inside the base controller. Tongue

[eluser]edwin87[/eluser]
Yes i understand that, but is there a easy way to use a module to load and to visit a url?
Or do i have to write 2 modules?

1 for to load inside a module
1 for to visit in a url: example.com/profile.html

That sounds a bit weird...

[eluser]wiredesignz[/eluser]
I'm sorry edwin, I can't help you design your code. But I am definitely here to try to help with ME errors as you find them. Good luck with your stuff.




Theme © iAndrew 2016 - Forum software by © MyBB