Welcome Guest, Not a member yet? Register   Sign In
HMVC, i18n and Simple Templating System, but Redux Auth Library Problem
#1

[eluser]nizsmo[/eluser]
Hi All,

Just want to ask the experts here a small question Smile
I have currently set-up the following in my codeigniter installation:

http://maestric.com/en/doc/php/codeigniter_i18n

http://maestric.com/en/doc/php/codeigniter_template

http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/

And all these work perfectly off course with some customizations. Then yesterday I wanted to setup redux auth library:
http://code.google.com/p/reduxauth/

And everything seems to work all ok except one little thing which bugs me. In any of the modules (take the user module for example) we have a call to a simple function in the reduxauth library:
Code:
$redux = $this->redux_auth->login
            (
                $this->input->post('email'),
                $this->input->post('password')
            );

which is simply to verify if the user is properly logged in. However, I keep getting the error:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Login::$redux_auth

Filename: controllers/login.php

Line Number: 26


Fatal error: Call to a member function login() on a non-object....

I have checked and the redux_auth library auto-loads fine in my autoload.php under my config directory, so I am stumbled as to why this is happening.

There is an easy fix, something like this will fix it:
Code:
$CI =& get_instance();
$redux = $CI->redux_auth->login
            (
                $this->input->post('email'),
                $this->input->post('password')
            );

however, I don't really want to go down this path for 2 main reasons:
1. Its one extra (and probably unnecessary) step
2. I don't know the cause, and in my opinion that's not good, as I want to find out exactly why the above is happening.

Interesting things to note:
1. In the exact same file, the line $this->validation->run() runs perfectly without any problems. The validation library is also loaded in the autoload file under the config directory.
2. I suspect (not sure at all) that it is something to do with the HMVC, and loading libraries, but cannot be totally sure.

Any help would be greatly appreciated, many thanks in advance!!! Smile Smile

Joe
#2

[eluser]nizsmo[/eluser]
Hope someone will reply to my question, as the problem is really annoying me, not able to find out exactly what is wrong...probably just something simple, if you see something that i fail to mention, feel free to ask, you never know, that might be the solution!!

Thanks in advance Smile
#3

[eluser]outrage[/eluser]
Just a quick guess without looking... are you using any MY_ prefixed resources?

The documentation for HMVC says:

Quote:Do not use the MY_Controller extension in your application/libraries directory. This will cause CodeIgniter to bypass loading Modular Extensions and modules will not function. If you need to run methods in a base controller define them in another module controller and use the controller autoload functionality.
MY_ prefixed resources are not loaded by ME when they are inside the module directory (e.g., MY_directory_helper.php is not loaded when it is in the modulename/helpers directory). This is because ME doesn’t check for MY_ extensions in modules. To get new functionality using helpers, plugins, models, etc… either make a new named file and load that resource or put your MY_ prefixed resource up in the requisite application directory (helpers for a MY_ helper, libraries for a MY_ library, etc…).
#4

[eluser]nizsmo[/eluser]
you are absolutely right! I am using the i18n library which has a MY_Language.php, and if I remove the language library, everything seems to work ok!

So I am not sure about how to solve this problem as i don't fully understand:
"either make a new named file and load that resource or put your MY_ prefixed resource up in the requisite application directory (helpers for a MY_ helper, libraries for a MY_ library, etc…)."

Any help would be much appreciated in regards to how to solve the problem, many thanks in advance! Smile
#5

[eluser]nizsmo[/eluser]
Sorry forgot to mention I have tried to rename the MY_Language.php file (to something else) and then autoload in my autoload.php, however this doesn't seem to work...

Thanks Smile




Theme © iAndrew 2016 - Forum software by © MyBB