Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Error in the server
#1

[eluser]Reza Valinezhad[/eluser]
I wrote a custom library. It works fine on my local system, but it causes error on the server.

This is the code of the library:

Code:
class MY_Table extends CI_Table {

    var $_classes = array();
    var $_ids = array();
    
    function MY_Table()
    {
    }
    
    function add_row_id($id)
    {
        $this->_ids[] = $id;
    }
    
    function add_row_class($class)
    {
        $this->_classes[] = $class;
    }
    
    private function callback_function($match) {
        static $index = 0;
        
        $id = isset($this->_ids[$index]) ? ($this->_ids[$index] ? " id='{$this->_ids[$index]}' " : "") : "";
        $class = isset($this->_classes[$index]) ? ($this->_classes[$index] ? " id='{$this->_classes[$index]}' " : "") : "";
        
        $index++;
        
        return $match[0] . $id . $class;
    }
    
    function generate($table_data = NULL)
    {
        $html = parent::generate($table_data);
        
        $html = preg_replace_callback('%<tr%', array($this, 'callback_function'), $html);
        
        return $html;
    }

}

In the server it says:
Code:
Fatal error: Call to undefined method CI_Table::add_row_id() in ***/contents.php on line 18


Messages In This Thread
[SOLVED] Error in the server - by El Forum - 04-30-2011, 05:58 AM
[SOLVED] Error in the server - by El Forum - 04-30-2011, 06:46 AM
[SOLVED] Error in the server - by El Forum - 04-30-2011, 07:00 AM
[SOLVED] Error in the server - by El Forum - 04-30-2011, 07:16 AM
[SOLVED] Error in the server - by El Forum - 04-30-2011, 07:19 AM
[SOLVED] Error in the server - by El Forum - 04-30-2011, 07:34 AM
[SOLVED] Error in the server - by El Forum - 04-30-2011, 07:39 AM
[SOLVED] Error in the server - by El Forum - 04-30-2011, 07:57 AM
[SOLVED] Error in the server - by El Forum - 05-01-2011, 10:18 PM
[SOLVED] Error in the server - by El Forum - 05-01-2011, 11:42 PM
[SOLVED] Error in the server - by El Forum - 05-12-2011, 09:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB