Welcome Guest, Not a member yet? Register   Sign In
Modules? Easy? Absolutely not!
#1

Hi,

I'm trying to wrap my head around using Modules in CI4 – I used to be fine with the (third party) HMVC version in CI3. But holy mother of c... am I confused. Setting autoloads, setting routes, fiddling with 'explorers'(?), seriously!?

Why hasn't it simply been implemented so that I can dump whatever module I've created into a folder called Modules (somewhere that makes sense) and start using them (yeah, yeah, performance yadda yadda)? Why do I have to go through hoops and loops to even understand the structure and all the things I have to fiddle with ... I've read the docs over and over and still end up googling the crap out of it ... and getting even more confused as the questions (and non working 'solutions') are all over the place ... so far CI 4 has not been a nice experience when is comes to ANYTHING besides the 'basics'.

Does ANYONE know of an isolated app that show HOW I can implement and use a simple module in an app? Now, THAT would be nice ... and probably even helpful.

Sorry if I sound frustrated, if, then that is actually the case. But sorry anyway.
Reply
#2

I'm be able to help you. Provide me your Skype id, so we can talk about that.
Reply
#3

Example Blog Module:

Root with ./app

app
Blaasvaer/Blog
-- Config
---- Routes.php
---- etc;
-- Controllers
-- Any other app folders you need.
-- Views

Autoload:

Add your namespace and module folder name.


PHP Code:
// Notice the \ back slash        Notice the forward slash
'Blaasvaer\Blog' => ROOTPATH 'Blaasvaer/Blog'// Module Blog,
// Namespace                       Folder path. 

In your Blog module under the Config/Routes.php ad this:

PHP Code:
/**
 * Blaasvaer/Blog: routes file.
 */

$routes->group('', ['namespace' => 'Blaasvaer\Blog\Controllers'], function($routes)
{
    $routes->get('blog''Blog::index');
}); 

Create your Blog Controller and View file in you Blog Module and it should work.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Thanks, I'll give it a got ... but right now I'm struggling to get even composer to create a project. So, I guess I have to take the VERY long road around CI4.
Reply
#5

Just copy the composer.phar file into the project root.

When running composer make sure your in the project root.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB