Welcome Guest, Not a member yet? Register   Sign In
does not automatically redirect for the use of modules.
#1

(This post was last modified: 12-17-2023, 01:51 AM by mywebmanavgat.)

Even if I follow the documentation, the core tries to find it in the default namespaces.

I defined $moduleRoutes in the roiting.php file. but still failed.


[Video: https://www.youtube.com/watch?v=eFxTE1T-UGc]
Reply
#2

Try this: https://github.com/kenjis/ci4-modules-te...e51aa45eb1
Reply
#3

(12-17-2023, 04:15 AM)kenjis Wrote: Try this: https://github.com/kenjis/ci4-modules-te...e51aa45eb1

I applied the changes but

I keep getting the error No controller is found for: login.

You can download here my empty ci4 Project : https://s6.dosya.tc/server17/lb8trr/ci4.zip.html
Reply
#4

PHP Code:
<?php
namespace Login\Controllers;
use 
App\Controllers\BaseController;
class 
Login extends BaseController
{
 public function 
__construct()
 {
 
parent::__construct();
 
$this->template->setContentViewPath('Login\Views');
 }
 public function 
getIndex()
 {
 
$data = [];
 
$this->template->set('title','Başlık');
 
$this->template->content('blog_view',$data);
 
$this->template->publish();
 }



Quote:Important
A controller method that will be executed by Auto Routing (Improved) needs HTTP verb (get, post, put, etc.) prefix like getIndex(), postCreate().
https://codeigniter4.github.io/CodeIgnit...ello-world
Reply
#5

This makes sense but isn't it ridiculous to make it mandatory? Ci3 was really great with everything, but I have to switch to ci4 because I'm not sure if there will be updates for the new php versions.

When I download your project, it works. but when I do it myself step by step, I get an error. anyway, no problem, I will go over it. thank you for your help.
Reply
#6

Adding the HTTP method to the controller's method name is mandatory.
Without this, a large number of vulnerabilities would be created that would allow controller filters to be bypassed.

Legacy auto routing can also be used in CI4, but is not recommended.

CI3 does not have controller filters, so they cannot be bypassed, but I am not sure that CI3's auto routing is truly secure.
An attack might be possible if the site is accessed by an HTTP method that the developer does not anticipate.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB