风火家人开发记要

技术总结精华贴

Tag: CodeIgniter

CMS, 原创

CI(codeigniter)开发之分页的多语言设置(第二课)

分页的配置文件写在 config文件夹中的 pagination.php文件中。 代码如下 $config[‘num_links’] = 5; $config[‘first_link’] = ‘第一页’; $config[‘last_link’] = ‘最后一页’; $config[‘next_link’] = ‘下一页’; $config[‘prev_link’] = ‘上一页’; 这个写,显然不能够多语言。 那就要继续添加代码。 在language文件夹中的语言文件夹中,如english (每个都要有哦),添加需要多语言话的字段, 比如我建的叫 my_lang.php 添加语言代码如下 $lang[‘page_first_link’] = ‘First Page’; $lang[‘page_last_link’] = ‘Last Page’; $lang[‘page_next_link’] = ‘Next Page’; $lang[‘page_prev_link’] = ‘Prev Page’; 这样对应的语言就有了(其他语言照样写)。 回来修改我们的pagination.php文件 $CI =& get_instance();//这句话就可以使用$CI引用语言了 $config[‘num_links’] = 5; $config[‘first_link’] = $CI->lang->line(‘page_first_link’); $config[‘last_link’] = $CI->lang->line(‘page_last_link’); $config[‘next_link’] = $CI->lang->line(‘page_next_link’); $config[‘prev_link’] = $CI->lang->line(‘page_prev_link’); 好,这样当您更换语言的时候,分页的语言也同时改变了(codeigniter)。 (944)

查看全文
CMS, 原创

CI(codeigniter)开发前基本准备(CI第一课)

既然已经选择了CI作为开发工具,那下载安装的事情也就不用说了。 如果你也希望把网站主题单独分离开来,那就继续往下看吧。 由于个人比较喜欢将主题页面放在根目录下的template文件夹中。 application/core/My_loader.php(系统默认用户拓展前缀为My_) class My_loader extends CI_loader { function __construct() { parent::__construct(); $this->_ci_view_paths = array(FCPATH.’template/’ => TRUE); } } 这样就可以在index.php所在目录(可能为跟目录)建立template文件夹,用来存放各种主题了。 测试:将application下的views文件夹中的welcome_message.php 放入到 template文件中,查看网页是否正常。 结果能够正常展示welcome_message.php的内容。 (659)

查看全文
CMS, 原创

解决Codeigniter的No input file specified错误Codeigniter(CI) error No input file specified

解决方法: 在网站根目录中找到php5.ini文件(如果没有就自己建一个),在文件中添加以下内容: cgi.fix_pathinfo = 1 解释:出现No input file specified错误的原因是php没有识别出pathinfo导致的,这是因为很多虚拟主机比如godaddy的,使用的是cgi模式(估计是为了同时兼容php4和php5)来运行php,因此会出现一些奇怪的问题。可以查看phpinfo看到“Server API: CGI/FastCGI”确认这一点。solution: At your website root directory edit php5.ini(If no this file,add one), and in this file add this: “cgi.fix_pathinfo = 1” why No input file specified? the reason is that php cannot distinguish pathinfo from it. many virtual machines ,like godaddy, use the mode of cgi,(perhaps to Compatible with php4 and php5) to run php. you will found that “Server API: CGI/FastCGI”” in phpinfo. (819)

查看全文
CMS, 原创

codeigniter(CI)图片处理不成功原因之GD库支持还是不支持

CI2.02 或者2.00在上传图片后处理图片发现,打水印或者改大小的总是不成功,将错误信息显示出来发现提示Your server does not support the GD function required to process this type of image. 以为真是像这句话提示的那样服务器不知道GD库?如果是支持呢,为什么还是这样的提示呢。 查下Image_lib.php中的代码发现是 在函数image_create_gd()处理时候的时候获取不到this->image_type的值,于是出现了上面的提示。 解决方法,最简单的解决方式就是在image_create_gd()的这句话$image_type = $this->image_type;前面加上$this->get_image_properties($path, FALSE);。加这句的意思很明显就是给image_type赋值。这样,整个世界平静了。一切归于正常。 (1519)

查看全文