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

[eluser]edwin87[/eluser]
Thanks, that would be great!

Keep up the good work!

[eluser]wiredesignz[/eluser]
Modular Extensions 4.3 is available on the wiki

Version 4.3 has been updated and now should work with CI 1.7.1

Please provide feedback if you find otherwise. Wink

[eluser]edwin87[/eluser]
When i work with multiple databases the application breaks. It worked before. What could be the problem?

[eluser]wiredesignz[/eluser]
edwin,

Can you provide a bit more detail please. Where does the application fail, errors, line numbers etc

It's difficult to find bugs without relevant information.

[eluser]edwin87[/eluser]
That's true!

I've created a base_controller. This handles basic functions. Like choose language and that sort of stuff.

For example:
Code:
<?php
class Base_controller extends Controller{

  var $data     =     array();    // Array om data op te slaan.
  var $aTalen     =     array();    // Array met talen
  var $wdb         =     FALSE;         // Website Database
  var $cdb         =     FALSE;         // CMS Database

function Base_controller()
    {

        
        ob_start();
         session_start();

        // Controller meeladen
        parent::Controller();
        
        $this->wdb = $this->load->database("website", true);
        $this->cdb = $this->load->database("cms", true);
        
        $this->load->model('main_model');
        $this->load->model('front_page_model');
            
    } // End function
  
}// End class
?>

On every module i include my base_controller and extend it like : news extends base_controller

So this time i don't have to load everytime my database.

Code:
$WEBDB = $this->load->database('website', TRUE);
$WEBDB->get('news');

With the defined vars in the base controller i only needed to do this:
Code:
$this->wdb->get('news');

So the vars in my base_controller are broken now.

Is there a way to fix this?

In 4.2 it did worked.

[eluser]edwin87[/eluser]
I hope i made myself clear. I also found out that the function database with $parameter didn't get a array like 4.2

Maybe this is a problem?

[eluser]wiredesignz[/eluser]
Modular Extensions 4.3.03 is available on the wiki

Updated to fix database loading and compared functionality against CI 1.7.1 on its own.

[eluser]edwin87[/eluser]
Thanks for your update!

But do you maybe have a solution for a base_controller? So that i don't have to do things multiple?

Like language selection like ChickenEggs in this thread?
http://ellislab.com/forums/viewthread/73177/P520/

It's strange because it worked in 4.2
So i can't set vars anymore.




I hope you can help me with this Smile


Edit:

I found out that it breaks in a model. In controllers it works. But i want to load as example : $this->wdb->get('pages'); in a model function.

But he gives a "Call to a member function on a non-object ". So he can't find the wdb var.

[eluser]wiredesignz[/eluser]
Try moving the database connections into the models that require them rather than loading them in the controller.

[eluser]edwin87[/eluser]
Hello,
Thanks, that worked Smile
But i liked it more like i did it before. I never had to load it again. However it works now Wink


But I found another bug.

I've got a photo module.

Here i load 3 models.

- fotoalbum_album_model
- fotoalbum_pics_model
- fotoalbum_category_model

I've got a function in the fotoalbum_category_model for example:
Code:
function get_FriendlyCatTitle($id)
{
return url_title($id);
}

I try to call that function in my fotoalbum_album_model.

Example:
Code:
function get_Photo_Item($id)
{
  $items = NULL;
  $items .= 'Blabla<BR>';
  $items .= $this->fotoalbum_category_model->get_FriendlyCatTitle('Loll this is a friendly photo item');

return $items;
}

Then it gives me a error like:
Quote:Call to a member function on a non-object

It seems that it doesn't load the model so i tried to load the model again inside the model But then it returns that the model already is loaded.

My debug
Quote:DEBUG - 2009-03-18 09:32:08 --&gt; Config Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Hooks Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; URI Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Router Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Output Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Input Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2009-03-18 09:32:08 --&gt; Language Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Loader Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Config file loaded: config/webqontrol_config.php
DEBUG - 2009-03-18 09:32:08 --&gt; Helper loaded: debug_helper
DEBUG - 2009-03-18 09:32:08 --&gt; Helper loaded: url_helper
DEBUG - 2009-03-18 09:32:08 --&gt; Helper loaded: html_helper
DEBUG - 2009-03-18 09:32:08 --&gt; Helper loaded: string_helper
DEBUG - 2009-03-18 09:32:08 --&gt; Helper loaded: form_helper
DEBUG - 2009-03-18 09:32:08 --&gt; Helper loaded: security_helper
DEBUG - 2009-03-18 09:32:08 --&gt; Helper loaded: text_helper
DEBUG - 2009-03-18 09:32:08 --&gt; Plugin loaded: captcha_pi
DEBUG - 2009-03-18 09:32:08 --&gt; Language file loaded: language/dutch/webqontrol_lang.php
DEBUG - 2009-03-18 09:32:08 --&gt; Language file loaded: language/dutch/_fotoalbum_lang.php
ERROR - 2009-03-18 09:32:08 --&gt; Language file contains no data: language/dutch/_nieuws_lang.php
DEBUG - 2009-03-18 09:32:08 --&gt; Language file loaded: language/dutch/_contact_lang.php
DEBUG - 2009-03-18 09:32:08 --&gt; Language file loaded: language/dutch/_zoeken_lang.php
DEBUG - 2009-03-18 09:32:08 --&gt; Language file loaded: language/dutch/_login_lang.php
DEBUG - 2009-03-18 09:32:08 --&gt; Language file loaded: language/dutch/_reactie_lang.php
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Form Validation Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Email Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Session Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Session routines successfully run
DEBUG - 2009-03-18 09:32:08 --&gt; Pagination Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Model Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Fotoalbum Controller Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; File loaded: application/models/main_model.php
DEBUG - 2009-03-18 09:32:08 --&gt; Model Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; File loaded: application/models/front_page_model.php
DEBUG - 2009-03-18 09:32:08 --&gt; Model Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; File loaded: application/views/frontend/zoeken/zoek_formulier_front.php
DEBUG - 2009-03-18 09:32:08 --&gt; File loaded: application/models/frontend/nieuws/nieuws_model.php
DEBUG - 2009-03-18 09:32:08 --&gt; Model Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; File loaded: application/modules/fotoalbum/models/fotoalbum_category_model.php
DEBUG - 2009-03-18 09:32:08 --&gt; Model Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; File loaded: application/modules/fotoalbum/models/fotoalbum_album_model.php
DEBUG - 2009-03-18 09:32:08 --&gt; Model Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; Database Driver Class Initialized
DEBUG - 2009-03-18 09:32:08 --&gt; File loaded: application/modules/fotoalbum/models/fotoalbum_pics_model.php
DEBUG - 2009-03-18 09:32:08 --&gt; Model Class Initialized

Shows me that it is loaded. So what could be the problem here?




Theme © iAndrew 2016 - Forum software by © MyBB