Switched to PHP5 and CI Broke, Please help!

#1
[eluser]otherjohn[/eluser]
Hi all,
Can you help me find out what to change to make this fix.
I get this error
Fatal error: Call to undefined method CI_Loader::_reverseFormatNumber() in ...../**/application/views/index_view.php on line 12

line 12
Code:
<h3>&lt;?php echo anchor($this->_reverseFormatNumber(2,$row->phoneID),$this->_reverseFormatNumber(2,$row->phoneID)); ?&gt;</h3>

and the code for _reverseFormatNumber
Code:
function _reverseFormatNumber($format,$number){
    
        if($format ==1){
            return "(".substr($number,0,3).") ".substr($number,3,3)."-".substr($number,6,4);
        }else if($format == 2){
            return substr($number,0,3)."-".substr($number,3,3)."-".substr($number,6,4);
        
        }
    }

#2
[eluser]The Wizard[/eluser]
shouldnt CI work with PHP5 too?

#3
[eluser]wiredesignz[/eluser]
It appears you are trying to call the method in a ($this) controller from inside the view.

In PHP5, CI_Loader is a seperate object so does not allow controller calls from views.

Move the function to a helper.

#4
[eluser]otherjohn[/eluser]
Yeh, I did that and it works now, thanks!

#5
[eluser]dbashyal[/eluser]
[quote author="wiredesignz" date="1217565907"]It appears you are trying to call the method in a ($this) controller from inside the view.

In PHP5, CI_Loader is a seperate object so does not allow controller calls from views.

Move the function to a helper.[/quote]

Thanks wiredesignz.

I was having hard time too with this.

you saved my life.

#6
[eluser]rip_pit[/eluser]
[SOLVED!]
sorry to reup this old post but i now get a very similar error

The error is
Quote:Call to undefined method CI_Loader::myfunction() in /xxx/www/system/application/libraries/MY_Controller.php on line 108

removed by author

EDIT:
Sorry guys, i finally solved the problem

it was only due to an incorrect case in filename : missing uppercase in

MY_loader.php

it should be
MY_Loader.php

i didn't seen this problem while working under windows, but only when online. solved now Big Grin

#7
[eluser]Phani K[/eluser]
Hi Guys...
Please help me here...

Fatal error: Call to undefined method CI_Loader:Confusedetdata() in /opt/lampp/htdocs/ci/system/application/controllers/auth.php on line 159

When i am using "auth" library for user authentication module. What i have to do.....?

#8
[eluser]WanWizard[/eluser]
Find out where this setdata() comes from, because the loader library doesn't have a method by that name.

It looks like the auth library was written for an old version (1.5.x) of CodeIgniter. Lots might have been changed since then. I suggest you switch to Ion Auth. Well maintained, and works perfectly.

#9
[eluser]Phani K[/eluser]
Thanks for your post.

Even i tried with Ion Auth, i am facing lot of problems.as i am new to this.... can you please provide me a step-by-step documentation with the same.

#10
[eluser]WanWizard[/eluser]
A bit difficult if you keep "the lot of problems" to yourself.

What's your environment? What have you done? What went wrong?

Did you take the time to go through the examples and the user guide that comes with Ion Auth (http://github.com/benedmunds/CodeIgniter-Ion-Auth)?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.