default data passed through BaseController - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: default data passed through BaseController (/showthread.php?tid=75921) |
default data passed through BaseController - Codinglander - 03-29-2020 Hi there... I'm trying to do my first project with CodeIgniter 4. I want to pass standard data to View set inside the BaseController. But following code does not work: Controller (BaseController) PHP Code: public $data = [ PHP Code: public function index() I want to have default variables which I can change in the controller. Any Ideas ? Thanks, Kigh... Now it works fine, but I get an error with preloading "session": Quote:Fatal error: Uncaught ErrorException: touch(): Unable to create file NULL/ci_session7roacrtom0dsiftqc3pdd0j1jnjv6ejo because No such file or directory in C:\xampp\htdocs\kighlander.local\system\Session\Handlers\FileHandler.php:252 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'touch(): Unable...', 'C:\\xampp\\htdocs...', 252, Array) #1 C:\xampp\htdocs\kighlander.local\system\Session\Handlers\FileHandler.php(252): touch('NULL/ci_session...') #2 [internal function]: CodeIgniter\Session\Handlers\FileHandler->write('7roacrtom0dsift...', '__ci_last_regen...') #3 [internal function]: session_write_close() #4 {main} thrown in C:\xampp\htdocs\kighlander.local\system\Session\Handlers\FileHandler.php on line 252 RE: default data passed through BaseController - InsiteFX - 03-29-2020 Your getting the session error because the variable session is missing in the BaseController. Here is Mine. PHP Code: <?php RE: default data passed through BaseController - Codinglander - 03-29-2020 Ah, THAT was the issue... Thank you very much !!! <3 |