Basic Codeigniter HMVC Installation - codeigniter

I have a existing working installation of CI 2.02 that autoloads libraries and helpers. When I perform the HMVC installation by dropping the core and 3rd party files into their respective locations in the CI directory, I get the error
Fatal error: Cannot access empty property in C:\xampp\htdocs\APPNAME\application\third_party\MX\Loader.php on line 208
When I remove all helpers from application/config/autoload.php, i get
An Error Was Encountered
Unable to load the requested file: helpers/_helper.php
When I use a clean CI installation with no libraries or helpers autoloading, it works fine. What should I do to get HMVC and autoloading to work?
I installed HMVC by following the instructions on their website (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home). I only did Step 15 and doing Step 6 shows the error I mentioned earlier. I have a single controller file in /application/controllers, a single model file in /application/models and a single view file in /application/views which I move to /application/modules/site/controllers, /application/modules/site/models and /application/modules/site/views respectively. I left the config.php, autoload.php anad database.php as they are in the application folder.
Before installing HMVC (performing Steps 1-6 from their website), I already have a existing CI project. I am autoloading some libraries and helpers (database, session, file, url, forms, text) using application/config/autoload.php.
Is there any more info that I need to show to figure out where the problem lies in? This is my first CI project so its nothing fancy. Thanks!

Upgrade to 2.0.3 and the latest version of HMVC, it should work fine.

Related

Laravel's ui:auth command generating incompatible Controllers

I have a Laravel installation on v7.29.3 (our server won't support v8 yet)
I am having an issue with the ui:auth command. It is generating Controllers that reference classes in the Illuminate namespace that don't exist.
For example, the Auth\VerificationController class it gives me, uses Illuminate\Foundation\Auth\VerifiesEmails but I can't see a corresponding file in the /vendor/laravel/src/Illuminate/Foundation/Auth directory.
What's more, when I search for "VerifiesEmails" in the Laravel API doc for v7.x there is no such file. This file does exist however when I search for it in v6.x
So my guess is that I've got a mismatch somewhere and I'm getting v6 controllers for a v7 installation.
However, composer is showing that I have laravel/ui 2.5 which is supposed to be for Laravel 7.
I've tried deleting my composer.lock and vendor directories and reinstalling from composer in the hope that would clear up the issue, but no dice.
Any ideas what could be going on?
Those classes aren't in vendor/laravel/framework/src/.... They are not part of the framework. They come from the laravel/ui package, vendor/laravel/ui/auth-backend/....

Codeigniter 4 Modules not working properly

I have been trying to setup codeigniter 4 modules but it seems something is not working properly
it takes me to 404 or not found.
i have gone through this doc : https://codeigniter4.github.io/CodeIgniter4/general/modules.html?highlight=modules
I have simply installed Ci4 and follow this doc did not tweaked anything else as we do in previous ci 3 hmvc practice.
Is there anything else beside autoload ?
I'm basic php dev. please guide.
As DFriend indicates, it's difficult to know what the issue could be based on the minimal information provided.
That said one difference between CI3 and CI4 that I noticed is the location of the base index.php, which in CI4 is located within the "public" directory. So, assuming you are using Apache, you need to adjust it's default directory to include public.
_t

External PHP Include in Laravel

We run a main website which is not made in Laravel. A specific script on this website however is made in Laravel. We need this script (or to be exact, a specific view inside of it) to fetch some resources from the main website (PHP files which mainly include HTML). When, inside the Laravel application, we try to include these resources, we can not - as they don't exist in the Laravel project workspace. This results in an error that the file does not exist. Attempting to climb out of the project (../../../file.php) does not seem to help either.
We're including it this way:
<?php
include '~/template/nav.php';
?>
We don't wish to include this file into the actual Laravel project, as that would require having to update it twice to ensure they remain equal. Is there any way for us to include this "external" file in our view? Every bit of research done seems to suggest adding it into the project, which would just cause twice the amount of administration on updates.
Cheers!
Just faced same problem. My Laravel Project is an API that need's to include outside php file. So what I did was specify entire path:
include($_SERVER['DOCUMENT_ROOT'].'/../../my_example_file.php');
$_SERVER['DOCUMENT_ROOT'] will lead you to Laravel's public folder.

install kohana into another website

I have a website that is built with kohana and another one that is built without any framework. I would like to include the first site into the second as an application ( you can write only a report with it).
The first website it's not mine( I never used kohana) so I don't understand everything very well. Inside a folder(let's call it KOHANA) I have index.php a .htaccess file and other 3 folders:
application,
system,
modules.
I've put the kohana folder inside my website(inside the public_html folder), but nothing works...First I had an error with magic quotes, then with the log directory, the other errors ...and I kept looking for solutions and fixing the errors, but I keep getting other errors. The last one is: logsThe URI you submitted has disallowed characters. It's an old version of Kohana. How can I set-up kohana into my website without getting any new errors. I don't know if I made myself clear. Thank you.

code igniter framework guidance for beginners

I am just a beginner in code igniter. I have just downloaded the code igniter framework. But i don't know that where should i keep my html, php files and stylesheets, images etc. Is there any procedure to do the things? Please guide me.
CodeIgniter has an awesome user guide that will come with the install you can read through (or read it online at - http://codeigniter.com/user_guide/ ), or you can watch some of the videos on their site - http://codeigniter.com/tutorials/
In comparison to most other frameworks you're going to find they have maybe the smallest learning curve and great documentation. I would also recommend learning basic PHP and getting familiar with your web environment maybe before beginning.
I used these tutorials to help get me started with the framework haven't look back since! http://net.tutsplus.com/sessions/codeigniter-from-scratch/
hi I am a weekend coder and picked up CI about a year ago.
It helped me a lot.
The best tutorial I found was on the IBM's developer site. It runs through putting together a simple application. Admittedly, there's nothing in it about directory and file placement but it helps cement ideas about how models, views and controllers (MVC), and why MVC is so helpful. Because the basic idea is quite simple, it's worth running through a simple CI tutorial again and again till you 'feel' or intuit the basic helpfulness of the setup.
Things like JS, CSS files can be kept in their own folders at the first level of your website folder e.g /js or /css or /images. You ask about PHP files as well. PHP files which you, the coder, write, are either 'views', 'models' or 'controllers'. These go in the folders with those names in the /application folder e.g /application/views/yourview.php or /application/controllers/yourcontroller.php. The CI install comes with a default view file and a default controller, which you are probably already aware of.
The files inside /application/config are important as well. Read the user-guide about tweaking these files. The most obvious tweaks are to database.php to connect to your db, autoload to give automatic use of CI helpers/libraries which you can choose, and to config.php to give CI the name of your website e.g the name you give to '/'.
The file 'index.php' comes with the CI installation (/index.php). You don't need to fiddle with it at all really except to determine the level of error reporting you want ('environment') and that's not a priority at all. But it's important to remember this about index.php - that CI uses it as the essential reference for defining paths to useful folders like CSS or images. So even if your view file is in /application/views, if it refers to an image like a logo.gif in /images for example, the path to it is just /images/logo.gif. It is not anything more complicated like ../../images/logo.gif.
I hope that helps.
Tom
Offline version of CodeIgniter user guide is available with CodeIgniter which already downloaded by you.
just extract your CodeIgniter zip file in your localhost server root directory,
Then http://localhost/www/CodeIgniter_2.1.2/user_guide/ open this url with browser ,here you can access offline version of CodeIgniter user guide.
Here I am using wamp server so I used this url, If you are using xampp server then please use http://localhost/CodeIgniter_2.1.2/user_guide/
Okay this is what I would usually do for code igniter
here is my directory structure.
CI App Path (e.g "c:\xampp\htdocs\ci_app_name" )
-application
-system
-assets
--css (new folder , where css files will be included)
--js (javascript and jquery libraries location)
Basic HTML and PHP files should be location
CI_app_pah
-application
--views (this is where to put HTML and PHP files)
For other things such as Controller , Models and Views , you can't put any where but put in their related area.
That will be
CI app
-application
--controllers
--models
--views

Resources