Welcome Guest, Not a member yet? Register   Sign In
Multi language web
#1

(This post was last modified: 07-06-2020, 01:12 AM by jreklund.)

Hi, I'm using localization to make my website  Multi-language website so what I did is in the Language folder I added the following, en folder, and ar folder. So the structure is 

Language
  ar
     home_view.php
   en
     home_view.php
and in the routes.php I added the {locale} like below

PHP Code:
$routes->get('{locale}/''Home::index');
$routes->get('changelang/(:any)''Home::changelang/$1');
$routes->get('f''Home::f');


// Post routes

$routes->group('post' , function($routes){
    
$routes->add('{locale}/','post\Post::index');
});

// User
$routes->group('user' , function($routes){
    
$routes->add('{locale}/register','User\Users::register');
    
$routes->get('login' 'User\Users::login');
    
$routes->add('{locale}/logout' 'User\Users::logout');
});
// Admin
$routes->group('admin' ,['filter' => 'AdminFliter'], function($routes){
    
$routes->add('{locale}/dashboard' 'User\Admin::dashboard');
    
$routes->get('{locale}/profile' 'User\Admin::profile');
    
$routes->add('{locale}/edit_profile' 'User\Admin::edit_profile');
    
$routes->add('{locale}/posts' 'User\Admin::posts');
    
$routes->add('{locale}/addPost' 'User\Admin::addPost');
    
$routes->add('{locale}/post_delete/(:any)' 'User\Admin::post_delete/$1');
    
}); 
it is working only with the home page which is the route and the others it gives me
404 - File Not Found

Controller or its method is not found: {0}::{1}

so what I am missing?
Reply
#2

View files should go into the Views folder not the language folder.

The Language folder holds arrays of the language definitions.
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