多语言设置codeigniter [英] Multilingual set up of codeigniter
问题描述
我正在使用本教程
第二,以MY_为前缀的文件(默认配置)是核心类(请参阅核心类)不是一个库,应该放在application / core目录下。
第三个,在您的视图文件中,尽量避免使用php短标记(<?= $ variabel;?>
), php短标签。使用正常 echo
标记<?php echo $ var; ?>
。
如前所述,如果您遵循更新的教程,您的脚本应该像我一样工作。我希望这个帮助。对不起,我的英语,如果我错了,请纠正我。
I'm using this tutorial http://sumonbd.wordpress.com/2009/09/16/develop-multilingual-site-using-codeigniter-i18n-library/ for multilingual in codeigniter.
I've follow the instruction listed correctly. It does not gave me any error, but I couldn't say that it is working properly. when I run through mysite.com/en/about and mysite.com/fr/about it always give me the default language which is english. I'm wondering if there is any configuration that I need to set to be able to work properly.
I'm thinking about this in config.php
$config['language']
and
this in autoload.php
$autoload['language']
Do I have to configure those? or any other configuration to work the multilingual properly.
Sorry, you don't provide enough information about what you have done. But I'll try to answer.
I've try the updated tutorial, and it's works like a charm.
First, you point to an out to date tutorial. This is the source of your link with an update: source
Second, a file prefixed with MY_ (default configuration) is a core classes ( see Core Classes ) not a library and should be placed on application/core directory.
Third, in your view file, try to avoid using php short tag (<?=$variabel;?>
) because not all server configuration enable php short tag. Use normal echo
tag instead <?php echo $var; ?>
. Longer, but worth it as you write the standard pattern.
As I said before, if you follow the updated tutorial your script should work as mine. I hope this help. Sorry for my English, correct me if I'm wrong.
这篇关于多语言设置codeigniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!