Welcome Guest, Not a member yet? Register   Sign In
conflict with method name
#1

(This post was last modified: 02-23-2021, 02:21 PM by eleumas.)

Hi! i use localization in CI 4.1.1. I have a controller for each language and inside any controller there is a method called blog.

Method blog in italian controller:
PHP Code:
    public function blog()
    {
        
$data['title'] = 'blog in italian';
        
$data['articles'] = $this->articlesModel->orderBy('id''DESC')->where('status'1)->where('lang''it')->findAll();
        
$data['categories'] = $this->categoriesModel->where('lang''it')->findAll();

        echo 
view('blog'$data);
    } 

Method blog in english controller:
PHP Code:
    public function blog()
    {
        
$data['title'] = 'blog in english';
        
$data['metaDescription'] = '';
        
$data['articles'] = $this->articlesModel->orderBy('id''DESC')->where('status'1)->where('lang''en')->findAll();
        
$data['categories'] = $this->categoriesModel->where('lang''en')->findAll();

        echo 
view('blog'$data);
    } 

My routes:

PHP Code:
$routes->add('{locale}/blog''It/Main::blog');
$routes->add('{locale}/blog''En/Main::blog'); 

The result is always the same..it is called only the method blog in "italian controller". 
Codeigniter show the first route found, so in this case for the "italian controller".

Thanks for the support.
Reply


Messages In This Thread
conflict with method name - by eleumas - 02-23-2021, 02:20 PM
RE: conflict with method name - by iRedds - 02-23-2021, 09:39 PM
RE: conflict with method name - by eleumas - 02-24-2021, 03:35 AM
RE: conflict with method name - by iRedds - 02-24-2021, 06:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB