Open Welcome.php file in controllers directory. $siteLang = $ci->session->userdata('site_lang') Initialize function loads the content based on selected language by user. ) Create a LangaugeLoader class for multilingual website in codeigniterĬreate LangaugeLoader.php file in application/hooks directory. Create a file named content_lang.php with the code. Create an English translation fileĬreate a folder named English in application/language folder. Let us create language files with a welcome message and content key. $autoload = array('session') Create language translation files Open autoload.php in config folder and go to the line add session library. Open autoload.php in config folder and go to $autoloadĪnd change it as $autoload = array('url') Autoload libraries With $config = "REQUEST_URI" Autoload URL helper Open config file in “application/config” directory. $config = "" Change uri_protocol in config file Open config.php file from the folder “application/config”. RewriteRule ^(.*)$ index.php/$1 Remove index.php file from index_page in config Open root directory of the project and create a. To create a SEO friendly URL we need to remove index.php. In a codeigniter application, the URL for the controller and actions contains index.php. $config = ' Remove index.php from the URL Go to the line, base_url and change it to. Open config.php in application/config.php. Configuration of the projectīefore development of the application, we need to configure the project. Open the project directory in your favorite editor such as visual studio code, atom or phpstorm. Application directory contains controllers, core, views, libraries, hooks, language and other important directories.Ĭreate a multilingual website in CodeIngniter If you have XAMPP installed, rename the folder to multilingual app in codeigniter and put it in the htdocs or It contains application, system folder and other files. Unzip the file and put it in the root directory of your web server.
PHPSTORM CODEIGNITER DOWNLOAD
To download CodeIgniter framework, visit CodeIgniter home page and download the latest version. Add English, French, German, Spanish translation language files Configure the application config settingsĤ. Create a multilingual website in CodeIgniterģ.