CodeIgniter Forums
Rest Controller Error, Not Sure How To Troubleshoot - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Rest Controller Error, Not Sure How To Troubleshoot (/showthread.php?tid=66999)



Rest Controller Error, Not Sure How To Troubleshoot - chadzilla - 12-30-2016

Hello,

Of course at this point, I created an account, searched through the forum for some possible insight, but I tried implementing Chrisk Acer Guis CodeIgniter Rest Server {https://github.com/chriskacerguis/codeigniter-restserver} and I encountered a problem when trying to access a particular controller.

Error::

Fatal error: Class 'REST_Controller' not found in /var/www/html/my_website_here/application/controllers/admin/Pages.php on line 5

Pages Class::


Code:
<?php defined('BASEPATH') OR exit('NO direct script access allowed');

require APPPATH.'/libraries/REST_Controller.php';

class Pages extends REST_Controller {

   function __construct() {

      parent::__construct();
   }

   function page_get() {

      // Test Only
   }

}



I tried Google and there's no real steps to trouble shoot here. I'm not sure if there's a conflict somewhere, I'm using CodeIgniter 3.


RE: Rest Controller Error, Not Sure How To Troubleshoot - Wouter60 - 12-31-2016

Try:
PHP Code:
require APPPATH.'libraries/REST_Controller.php'



RE: Rest Controller Error, Not Sure How To Troubleshoot - InsiteFX - 12-31-2016

It should be require_once the docs say.


RE: Rest Controller Error, Not Sure How To Troubleshoot - ivantcholakov - 01-05-2017

Troubleshooting: Take the source before this commit: https://github.com/chriskacerguis/codeigniter-restserver/commit/a5ea7ff53710406115a7ba299e1fff3a2a1a41a3