problem in internationalzation of php website using codeigniter_i18n |
[eluser]Shwetang[/eluser]
Hi ppl, I tried to convert a portuguese php website in english using the steps mentioned in http://maestric.com/doc/php/codeigniter_i18n .... below is a short description of my steps and error: 1.I placed the 2 files My_lang.php and My_config.php in core application/core 2.application/language I created 2 folders with english and portuguese name in which i created 2 files with home_lang.php name(in both folders)... 3.then application/config/routes.php ..I added the code mentioned under "configuration" topic at http://maestric.com/doc/php/codeigniter_i18n 4.then application/controllers/main_controller.php... I added the code mentioned under"controllers" topic at http://maestric.com/doc/php/codeigniter_i18n 5.Now tried to acces the page on the browser .. the error is mentioned below : A PHP Error was encountered Severity: Notice Message: Undefined index: main_controller Filename: config/routes.php Line Number: 44 A PHP Error was encountered Severity: Notice Message: Undefined index: main_controller Filename: config/routes.php Line Number: 45 404 Page Not Found The page you requested was not found. Please help
[eluser]Shwetang[/eluser]
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------------------------------------------------------------------- | URI ROUTING | ------------------------------------------------------------------------- | This file lets you re-map URI requests to specific controller functions. | | Typically there is a one-to-one relationship between a URL string | and its corresponding controller class/method. The segments in a | URL normally follow this pattern: | | example.com/class/method/id/ | | In some instances, however, you may want to remap this relationship | so that a different class/function is called than the one | corresponding to the URL. | | Please see the user guide for complete details: | | http://ellislab.com/codeigniter/user-gui...uting.html | | ------------------------------------------------------------------------- | RESERVED ROUTES | ------------------------------------------------------------------------- | | There area two reserved routes: | | $route['default_controller'] = 'welcome'; | | This route indicates which controller class should be loaded if the | URI contains no data. In the above example, the "welcome" class | would be loaded. | | $route['404_override'] = 'errors/page_missing'; | | This route will tell the Router what URI segments to use if those provided | in the URL cannot be matched to a valid route. | */ $route['^pt/(.+)$'] = "$1"; $route['^en/(.+)$'] = "$1"; // '/en' and '/fr' -> use default controller $route['^pt$'] = $route['main_controller']; $route['^en$'] = $route['main_controller']; $route['default_controller'] = "redireciona"; $route['404_override'] = ''; //novas rotas para o menu $route['home'] = 'main_controller'; $route['home-en'] = 'main_controller/index_en'; $route['a-bysat'] = 'bysat_controller'; $route['produtos-e-servicos']= 'prod_serv_controller'; $route['casos-de-sucesso'] = 'casos_controller'; $route['trabalhe-conosco'] = 'trabalhe_controller'; $route['entre-em-contato'] = 'contato_controller'; $route['contato'] = 'contato_controller/contato/'; $route['casos_detalhes/(:num)'] = 'casos_controller/detalhes/'; $route['segmentos/(:num)'] = 'casos_controller/segmentos/'; /* End of file routes.php */ /* Location: ./application/config/routes.php */
[eluser]NikosV[/eluser]
ok here's the problem... Code: $route[’^pt/(.+)$’] = “$1”; i would change these lines as follows: Code: $route[‘default_controller’] = “redireciona”; That should work ;-)
[eluser]Shwetang[/eluser]
hi ya it works but only this link http://localhost/en/about not the other one http://localhost/pt/about cz when i use this link it gets redirected to http://localhost/en/home and the output on screen comes as 404 Page Not Found The page you requested was not found.
[eluser]NikosV[/eluser]
i am not sure what is happening but i guess it has to do something with your controllers... delete or other routes and start from the very begining writing them checking each time the corresponding controller.
|
Welcome Guest, Not a member yet? Register Sign In |