[SOLVED] Error in the server - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [SOLVED] Error in the server (/showthread.php?tid=41183) Pages:
1
2
|
[SOLVED] Error in the server - El Forum - 04-30-2011 [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 { In the server it says: Code: Fatal error: Call to undefined method CI_Table::add_row_id() in ***/contents.php on line 18 [SOLVED] Error in the server - El Forum - 04-30-2011 [eluser]Sudz[/eluser] Can you post line number 18 of contents.php file [SOLVED] Error in the server - El Forum - 04-30-2011 [eluser]Reza Valinezhad[/eluser] Line 18 is Code: $this->table->add_row_id(0); The whole code Code: $tmpl = array('table_open'=>'<table class="normal" style="min-width:100%">'); It works fine as expected in localhost, but causes error in the server. [SOLVED] Error in the server - El Forum - 04-30-2011 [eluser]Sudz[/eluser] Have you uploded MY_Table library on the server and load that library in your controller or in config file? [SOLVED] Error in the server - El Forum - 04-30-2011 [eluser]Reza Valinezhad[/eluser] Yes. The code is absolutely same. I used this line in the controller: Code: $this->load->library('Table'); but I used it in the view. (line 18 is in the view). [SOLVED] Error in the server - El Forum - 04-30-2011 [eluser]Sudz[/eluser] Your library classes should be placed within your application/libraries folder, Try this to load your library Code: $this->load->library('Table'); And call class method using this code Here my_table must be in small case. Code: $this->table->add_row_id(0); You Class name must be Capital and file name in small case and both name must be same. Have you set this in your application/config/config.php $config['subclass_prefix'] = 'MY_'; [SOLVED] Error in the server - El Forum - 04-30-2011 [eluser]Sudz[/eluser] I think you have not included this in your library Code: public function __construct() [SOLVED] Error in the server - El Forum - 04-30-2011 [eluser]Reza Valinezhad[/eluser] I checked everything. All is set as you told. I replaced MY_Table()function by __construct(), but the error not solved. I just don't know why it works on localhost and not work on server. is there any php settings or something like that? [SOLVED] Error in the server - El Forum - 05-01-2011 [eluser]Sudz[/eluser] [quote author="Reza Valinezhad" date="1304187579"]Yes. The code is absolutely same. I used this line in the controller: Code: $this->load->library('Table'); but I used it in the view. (line 18 is in the view).[/quote] Load in The controller then try it [SOLVED] Error in the server - El Forum - 05-01-2011 [eluser]InsiteFX[/eluser] If you use your own template and not the default, you have to specify the whole table template code! I place it in a MY_Controller for CRUD operations! Code: $tmpl = array ( InsiteFX |