![]() |
Question on include() in a module [newbie!!] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Question on include() in a module [newbie!!] (/showthread.php?tid=92644) |
Question on include() in a module [newbie!!] - DarrenJ - 03-22-2025 Hi guys I am just starting my Ci journey, and am following a tutorial from Udemy. Basic app is allow users to register and then create a blog article. As extra "homework" I am adding functionality to edit a users name and email address. I have everything working but am hitting an issue with an include file and am after some guidance - I am sure I am missing something obvious here.. So, I have an Admin module, laid out thus: Code: Admin Code: <?= $this->extend('Layouts\default') ?> Code: <?= $this->include("Admin\Views\Users\\form") ?> I have played with adding APPPATH and ROOTPATH to the include path, but these don't work either. The error I get "Invalid file" and I have tried various combinations of the Admin\Views\Users, with backslashes, forward slashes - all with the same error. The code in the form.php file is in the code above, just commented out. If I uncomment it and comment out the include call, it all works. Please help a newbie! Thanks Darren RE: Question on include() in a module [newbie!!] - InsiteFX - 03-24-2025 What version of CodeIgniter are you using? RE: Question on include() in a module [newbie!!] - DarrenJ - 03-25-2025 Ah sorry - 4.6 RE: Question on include() in a module [newbie!!] - kcs - 04-17-2025 Maybe I am confused with the structure of your app, but if the view calling the form is at the same level within our views, have you tried Code: <?= $this->include("/users/form") ?> RE: Question on include() in a module [newbie!!] - captain-sensible - 04-17-2025 ive written a blog engine https://github.com/captain-sensible/CI4-CMS but it doesn't use shield i have have coded for one user. But basically it runs just about out of the box since it uses sqlite for db and therefore no messing with MySQl , phpmyadnin It uses sessions ,and checking if admin is logged in. Your welcome to fork RE: Question on include() in a module [newbie!!] - grimpirate - 04-19-2025 Assuming you followed the appropriate autoloading namespacing as per here the code you wrote works as expected. PHP Code: <?= $this->include("Admin\Views\Users\\form") ?> PHP Code: <?= $this->include('Admin\Views\Users\form') ?> |