Question on include() in a module [newbie!!] |
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
What version of CodeIgniter are you using?
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
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
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') ?> |
Welcome Guest, Not a member yet? Register Sign In |