Welcome Guest, Not a member yet? Register   Sign In
(solved) Why I can't load MY_ libraries?
#1

[eluser]4ever[/eluser]
Help please
signup_form.php

libraries:
application\libraries\Form_create.php
application\libraries\MY_Form_validation.php

Code:
<div id="login_form">

<h2>Sign up</h2>
<fieldset><legend>Personal information</legend>
&lt;?php
$this->load->library("MY_Form_validation"); // my library
$this->load->helper("MY_form"); // my helper
$this->load->library("form_create"); // my create

/*print_r($this->_ci_classes);
print_r($this->_ci_loaded_files);
print_r($this->_ci_helpers);
print_r($this->session->CI->my_form_validation);
*/


print_r($this->form_create);
print_r($this->my_form_validation);
die();

Returns error

A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$form_create
Filename: forms/signup_form.php

Line Number: 17
A PHP Error was encountered

Severity: Notice
Message: Undefined property: CI_Loader::$my_form_validation
Filename: forms/signup_form.php
Line Number: 18

Same as
print_r($this->Form_create);
print_r($this->MY_Form_validation);

I can't find $this->CI is it normal?
The 3 lines
print_r($this->_ci_classes);
print_r($this->_ci_loaded_files);
print_r($this->_ci_helpers);
showed that the are loaded...
#2

[eluser]Ellli[/eluser]
if you have in your config file:
Code:
$config['subclass_prefix'] = 'MY_';

than this:
Code:
$this->load->library("MY_Form_validation"); // my library
should be:
Code:
$this->load->library("Form_validation"); // my library

and as for helpers if you use them, than as i remember u don't have to use $this->. you just call the function.
#3

[eluser]4ever[/eluser]
[quote author="Ellli" date="1306098531"]if you have in your config file:
Code:
$config['subclass_prefix'] = 'MY_';

than this:
Code:
$this->load->library("MY_Form_validation"); // my library
should be:
Code:
$this->load->library("Form_validation"); // my library
[/quote]

Thanks for response!

Yes I use prefix MY_

But nothing happaens.

Still having problems:

Code:
<div id="login_form">

<h2>Sign up</h2>
<fieldset><legend>Personal information</legend>
&lt;?php
$this->load->library("Form_validation"); // my library
$this->load->helper("form"); // my helper
$this->load->library("Form_create"); // my create

/*print_r($this->_ci_classes);
print_r($this->_ci_loaded_files);
print_r($this->_ci_helpers);
print_r($this->session->CI->my_form_validation);
*/


print_r($this->my_form_create);
print_r($this->my_form_validation);
die();

A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$my_form_create
Filename: forms/signup_form.php
Line Number: 17
A PHP Error was encountered

Severity: Notice
Message: Undefined property: CI_Loader::$my_form_validation
Filename: forms/signup_form.php
Line Number: 18


Class is:
class Form_create ...

[quote author="Ellli" date="1306098531"]and as for helpers if you use them, than as i remember u don't have to use $this->. you just call the function.[/quote]
Yes. As far as I know, helpers are not classes/objects and they are not placed in CI object context. That is the second problem I need to solve according previous threads of mine. But lets solve this now, because it doesn't let me to sleep.
#4

[eluser]Ellli[/eluser]
well, maybe because you try loading library in view and it should be loaded in controller.
#5

[eluser]4ever[/eluser]
[quote author="Ellli" date="1306099567"]well, maybe because you try loading library in view and it should be loaded in controller.[/quote]

I thought about it. But

$this->load->library("Form_validation");
and
$this->load->helper("form");

was there in view (template) recently and the form worked.

I did not do backup Undecided So I don't know what I could vitiate.

I also try to remove it to controller but same problem.
#6

[eluser]4ever[/eluser]
Turnover!

THIS WORKS!

In controller * not in view
Code:
$this->load->library("form_create"); // SHOULD BE AUTO LOADED
print_r($this->form_create);
die();

And now explain why. No uppercase letters even that file and class is first letter uppercase!

This uppecase letters are so confusing in CI!

And this uppercase syntax in controller doesn't mind:

Code:
$this->load->library("Form_validation"); // my library
   $this->load->helper("form"); // my helper
   $this->load->library("Form_create"); // SHOULD BE AUTO LOADED
#7

[eluser]4ever[/eluser]
In view this is OK:

Code:
print_r($this->form_validation);
print_r($this->form_create);

In view this FAILS:
Code:
print_r($this->my_form_create);
print_r($this->my_form_validation);

Conclusion:
- I mustn't write the MY_ or my_ to library() and when I access my method through class.
- Yet I see that no Uppercase letters in load->library() does mind.
- Yet I see that no MY_ in class does matter.

But I expect the class should be named MY_...

Many thanks to Ellli




Theme © iAndrew 2016 - Forum software by © MyBB