Welcome Guest, Not a member yet? Register   Sign In
No Controller Call In Controller Anymore
#2

Just to let you know that now classs "My_Router" it's working as it should.
It would be great if you intergrate this to the "CI_Router" core.

So how it's working? Lets start with the base.
Default old settings :

controllers->Welcome.php

default url :
PROTOCOL://your-site.extension/
PROTOCOL://your-site.extension/Welcome
PROTOCOL://your-site.extension/Welcome/index

Default new settings :
after applying the code to the core it will automaticly redirect internet browser to the default_controller and it's default method.
So if user enter : PROTOCOL://your-site.extension/
it will directly become :
PROTOCOL://your-site.extension/Welcome/Index

and that's not all.

The other thing is when developer of the app want to have controllers organised like so :

Lets just for now pretend that we are now creating a structure of the controllers and developing new application.

Simple view :
The developer change a setting in the default_controller to class "Web".
that means the url will look like this :
PROTOCOL://your-site.extension/Web/Index

Next thing is that the developer want to act with user login for example which can be done this way :
the developer don't have to create any method called "User" where it will usualy operate with the user action.
Instead of that developer can create same named folder "Web" as the main class and create "User" class inside the folder with method "Login".

now we have : controllers->Web->User.php
and url :
PROTOCOL://your-site.extension/Web/User/Login
PROTOCOL://your-site.extension/Web/User/Logout
PROTOCOL://your-site.extension/Web/User/ResetPassword


Now the developer want to have a profile for user with option to view,delete or edit profile.
It can be done the same way as above.
All the methods can accept the id of the profile (by ID i mean some number).

example :
Create folder with the subclass name "User" and a new class inside with the name Profile.
so we have : controllers->Web->User->Profile.php
and url :
PROTOCOL://your-site.extension/Web/User/Profile/View/1
PROTOCOL://your-site.extension/Web/User/Profile/Edit/1
PROTOCOL://your-site.extension/Web/User/Profile/Delete/1

This feature will sort out :
1. Developer don't have to use too much settings in route to re-route and to have nice and simple url.
2. Keep controllers more organised and to have less code in each controller.
3. Developer can always continue use CodeIgniter the usuall way.
4. When intergrated,Developer don't need to write another file "My_Route.php".

Thanks for reading and I hope this feature will be in CI 4
PS; Don't hesitate to contact me if anyone will need answers.
Reply


Messages In This Thread
RE: No Controller Call In Controller Anymore - Update - by LukasStribrny - 04-01-2017, 10:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB