ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Switched to PHP5 and CI Broke, Please help!

July 31, 2008 5:45pm

Subscribe [6]
  • #1 / Jul 31, 2008 5:45pm

    otherjohn

    43 posts

    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

    <h3><?php echo anchor($this->_reverseFormatNumber(2,$row->phoneID),$this->_reverseFormatNumber(2,$row->phoneID)); ?></h3>

    and the code for _reverseFormatNumber

    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 / Jul 31, 2008 8:29pm

    The Wizard

    265 posts

    shouldnt CI work with PHP5 too?

  • #3 / Jul 31, 2008 8:45pm

    wiredesignz

    2882 posts

    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 / Jul 31, 2008 10:36pm

    otherjohn

    43 posts

    Yeh, I did that and it works now, thanks!

  • #5 / Sep 07, 2008 9:12pm

    dbashyal

    117 posts

    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.

    Thanks wiredesignz.

    I was having hard time too with this.

    you saved my life.

  • #6 / Mar 24, 2010 8:32pm

    rip_pit

    88 posts

    [SOLVED!]
    sorry to reup this old post but i now get a very similar error

    The error is

    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 :D

  • #7 / Aug 05, 2010 11:36am

    Phani K

    6 posts

    Hi Guys…
    Please help me here…

    Fatal error: Call to undefined method CI_Loader::setdata() 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 / Aug 05, 2010 11:59am

    WanWizard

    4475 posts

    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 / Aug 05, 2010 1:12pm

    Phani K

    6 posts

    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 / Aug 05, 2010 3:00pm

    WanWizard

    4475 posts

    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)?

  • #11 / Aug 06, 2010 1:02pm

    Phani K

    6 posts

    Hi

    When i follow the given link i.e http://github.com/benedmunds/CodeIgniter-Ion-Auth

    i am able to see the login page in my application.
    when i give the login credentials as specified in the readme file and submit.
    it is redirecting to the page “http://localhost/ci172/index.php/auth/index.php/auth/login”

    what i need to fix in my code?

    Note:
    1) I didnt added any new controllers yet.
    2) My codebase is in /opt/lampp/htdocs/ folder
    3) My codebase structure…

    phanik@phanik-desktop:/opt/lampp/htdocs/ci172$ ls
    application index.php nbproject system user_guide

  • #12 / Aug 06, 2010 3:32pm

    WanWizard

    4475 posts

    It looks like it doesn’t create the session cookie, and therefore doesn’t see you as logged in.

    Did you set the database up properly (with the required tables)? How is your session setup? Did you configure the session properly (config/config.php)?

    Note that ‘localhost’ for some browsers is an illegal hostname for a cookie, create a dummy hostname (citest.phanik.local) in your /etc/hosts file, have it point to 127.0.0.1, and use that in your apache config. Also, make sure the cookie path is properly setup in the config.

  • #13 / Aug 06, 2010 3:58pm

    Phani K

    6 posts

    Below is my config.php content


    <?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’);
    /*
    |—————————————————————————————————————
    | Base Site URL
    |—————————————————————————————————————
    */
    $config[‘base_url’]  = “”;

    /*
    |—————————————————————————————————————
    | Index File
    |—————————————————————————————————————
    */
    $config[‘index_page’] = “index.php”;

    /*
    |—————————————————————————————————————
    | URI PROTOCOL
    |—————————————————————————————————————
    | ‘AUTO’        Default - auto detects
    | ‘PATH_INFO’      Uses the PATH_INFO
    | ‘QUERY_STRING’  Uses the QUERY_STRING
    | ‘REQUEST_URI’      Uses the REQUEST_URI
    | ‘ORIG_PATH_INFO’  Uses the ORIG_PATH_INFO
    |
    */
    $config[‘uri_protocol’]  = “AUTO”;

    /*
    |—————————————————————————————————————
    | URL suffix
    |—————————————————————————————————————
    */

    $config[‘url_suffix’] = “”;

    /*
    |—————————————————————————————————————
    | Default Language
    |—————————————————————————————————————
    |
    */
    $config[‘language’]  = “english”;

    /*
    |—————————————————————————————————————
    | Default Character Set
    |—————————————————————————————————————
    |
    */
    $config[‘charset’] = “UTF-8”;

    /*
    |—————————————————————————————————————
    | Enable/Disable System Hooks
    |—————————————————————————————————————
    */
    $config[‘enable_hooks’] = FALSE;


    /*
    |—————————————————————————————————————
    | Class Extension Prefix
    |—————————————————————————————————————
    |
    | This item allows you to set the filename/classname prefix when extending
    | native libraries.  For more information please see the user guide:
    |
    | http://ellislab.com/codeigniter/user-guide/general/core_classes.html
    | http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html
    |
    */
    $config[‘subclass_prefix’] = ‘MY_’;


    /*
    |—————————————————————————————————————
    | Allowed URL Characters
    |—————————————————————————————————————
    |
    */
    $config[‘permitted_uri_chars’] = ‘a-z 0-9~%.:_\-’;


    /*
    |—————————————————————————————————————
    | Enable Query Strings
    |—————————————————————————————————————
    |
    */
    $config[‘enable_query_strings’] = FALSE;
    $config[‘controller_trigger’]    = ‘c’;
    $config[‘function_trigger’]    = ‘m’;
    $config[‘directory_trigger’]    = ‘d’; // experimental not currently in use

    /*
    |—————————————————————————————————————
    | Error Logging Threshold
    |—————————————————————————————————————
    |
    */
    $config[‘log_threshold’] = 0;

  • #14 / Aug 06, 2010 7:05pm

    WanWizard

    4475 posts

    There’s a lot missing from that.

    Don’t use localhost, but a proper host name. Remove any underscores from the cookie name (default is ci_session, rename it). Configure the sess_* variables in your config file so that you use database sessions (check the user guide and the ion auth instructions). Make sure the cookie_* config values are configured properly. the hostname should match the hostname of your site, the path should be “/”, unless you installed CI in a subdirectory.

  • #15 / Aug 09, 2010 11:38am

    Phani K

    6 posts

    Thanks for your support Wan…

    I need the user registration outside… here the admin is able to create teh user.

    How can i go ahead, am i have to create the register pages and other controllers for the same.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases