Welcome Guest, Not a member yet? Register   Sign In
Problems in extending the native class on Linux
#1

[eluser]Kumar Chetan sharma[/eluser]
Hi,
This is wiered. The following class works perfectly fine on Windows but fails in Linux.
And gives me following error.
Code:
Fatal error: Call to undefined method CI_Pagination::createAjaxPaginationLinks() in /media/sda5/lamp/www/html/CI/system/application/libraries/Menu.php on line 20
And the class is
Code:
<?php
class My_Pagination extends CI_Pagination
{
    public function __construct()
    {
        log_message('info', 'Loading class'. __CLASS__ );
        parent::__construct();
    }
   public function createAjaxPaginationLinks()
    {
/*I am just adding onclick=jscode to the links give by createlinks by pagination class.*/
    }

}
Here is how I use this class:
[code]
$this->CI->load->library('pagination');

$data['
#2

[eluser]InsiteFX[/eluser]
If I am not mistaken Linux is case sensitive on filenames try making all your file names lower case.

Enjoy
InsiteFX
#3

[eluser]Kumar Chetan sharma[/eluser]
I did rename the class. More over my other classes are loaded perfectly. What could be wrong with this one?
#4

[eluser]InsiteFX[/eluser]
Hi,

Try taking this out of Constructor or rem it out and see if it works for you.

Code:
parent::__construct();

Enjoy
InsiteFX
#5

[eluser]Kumar Chetan sharma[/eluser]
I will not help and I tried it as I have run out of options and didnt help me. I still see the same error. The class isnt loaded at all. I looked into logs.
#6

[eluser]jedd[/eluser]
The parent should be CI_Pagination .. this is pretty clearly covered in the Creating Core System Classes section of the user guide.
#7

[eluser]Kumar Chetan sharma[/eluser]
Is parent::CI_Pagination() different from parent::__construct();?
I doubt. Both point to parent constructor and *must* work same way. I did change it to CI_Pagination and I am following the guide properly. Otherwise the site wont work on my local Win XP development machine. It works perfectly fine. Though I can simply copy CI_pagination to app/lib and add my method to it but still, it works fine on windows.
#8

[eluser]jedd[/eluser]
Dunno .. I just read the manual and do what it says. (Consequently things tend to work okay for me.)

What is Menu.php - can you post that code that's making the call - and confirm that within it you're loading the MY_Pagination class? It looks like you're perhaps loading the CI_Pagination class instead. Are you loading these manually or within autoload?
#9

[eluser]jedd[/eluser]
Oh .. hang on. Have you changed the default prefix, or is that still set to MY_ ?

If it is, and you haven't, then your extension is failing because you're talking about My_

Quote:
Code:
class My_Pagination extends CI_Pagination


Again, this is pretty carefully explained in the manual.
#10

[eluser]Kumar Chetan sharma[/eluser]
I am autloading this class as the manual says. (I do RTFM first and when it fails I come to forums. Thats why you do not see too many posts by me ;-) Here is the menu class.Its named as Menu.php
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Menu  

{

    public function __construct()

    {

        $this->CI = &get;_instance();

        $this->CI->load->model('MenuModel','menumodel');

        $this->CI->load->library('EatoutsbibleConstants');

    }
    public function loadMenuRS($siteId, $num, $offset)

    {

        $this->CI->load->library('pagination');

        $data['menuRS'] = $this->CI->menumodel->getMenuBySiteID($siteId, $num, $offset);

        $config['base_url'] = base_url().'/Ajax/myAjaxMenu/'.$siteId.'/'.$num.'/' ;

        $config['total_rows'] = $this->CI->menumodel->getMenuCountBySiteID($siteId);

        $config['per_page'] = EatoutsbibleConstants::$perPage;

        $config['uri_segment'] = 5;

        $this->CI->pagination->initialize($config);

        $data['ajaxPaginationLinks'] = $this->CI->pagination->createAjaxPaginationLinks();

        return ($this->CI->load->view('menutable', $data, true));

    }
}




Theme © iAndrew 2016 - Forum software by © MyBB