codeigniter-2

Is there a function like _compile_select or get_compiled_select()?

笑着哭i 提交于 2019-11-27 23:43:44
Looks like _compile_select is deprecated and get_compiled_select is not added to 2.1.0. Are there any other functions like those two? And also I am curious. Is there any particular reason to not adding get_compiled_select() to Active Record and removing _compile_select ? I've added get_compiled_select() to DB_active_rec.php and it seems to work without problem, but i wouldn't remove _compile_select() since it's used in many other methods. The pull request for adding this method is here, with some other useful methods like: get_compiled_select() get_compiled_insert() get_compiled_update() get

Autoload language codeigniter

a 夏天 提交于 2019-11-27 21:52:33
问题 making a multi-language site with codeginiter. I have created two folders. One for french language files and one for english. When I go to autoload the languages (English and French) as such ($autoload['language'] = array('en', 'fr');) I get an error "Unable to load the requested language file: language/english/fr_lang.php" How can I get it to look in the proper folder? Thanks 回答1: $config['language'] is the default folder used for loading language files, which is why your fr_lang.php is

fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known

亡梦爱人 提交于 2019-11-27 19:36:46
问题 I am failing to send form contents to email. I am getting the following error: : Warning Message: fsockopen(): php_network_getaddresses: getaddrinfo failed:Name or service not known Filename: libraries/Email.php Line Number: 1986 Severity: Warning Message: fsockopen(): unable to connect to ssl://smtp.123mailsetup.com:25 (php_network_getaddresses: getaddrinfo failed: Name or service not known) Filename: libraries/Email.php Line Number: 1986 My line 1986 is $this->smtp_timeout); Part of the

CodeIgniter use CSRF protection only in some pages

守給你的承諾、 提交于 2019-11-27 18:34:07
问题 What I want to do is to protect some sensitive forms from CSRF attack in codeigniter but not all pages. To protect from CSRF if I set it in config.php it applies for all pages. is there any way to do that only for some pages by setting in controller? $config['csrf_protection'] = TRUE; 回答1: Now the CI3 have this feature, we can exclude the URIs in the config http://www.codeigniter.com/userguide3/libraries/security.html?highlight=csrf#cross-site-request-forgery-csrf $config['csrf_exclude_uris']

Send email by Email Class in codeigniter with Gmail

拟墨画扇 提交于 2019-11-27 14:33:08
I want send a email by Email Class in codeigniter with gmail, but i get following error: Error: A PHP Error was encountered Severity: Warning Message: mail() [function.mail]: Failed to connect to mailserver at "ssl://smtp.googlemail.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() Filename: libraries/Email.php Line Number: 1553 This is my full function in controll: function send_mail(){ $config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl://smtp.googlemail.com'; $config['smtp_port'] = 465; $config['smtp_user'] = 'xyz@gmail.com'; $config['smtp_pass'] =

Codeigniter 2 on IIS with web.config file

微笑、不失礼 提交于 2019-11-27 14:30:00
I have a codeigniter app working fine locally with WAMP. However, I am having trouble getting it to work on an IIS server. Please note that I do not want to enable query strings. Here is what I currently have in my web.config file: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Clean URL" stopProcessing="true"> <match url="^(.*)$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/

Codeigniter echoing [::1] instead of localhost

你说的曾经没有我的故事 提交于 2019-11-27 13:41:55
I am using CodeIgniter 3 as a web platform and trying to import semantic-UI CSS into my page. I'm doing so by using CodeIgniter's base_url() method in the href property for the CSS import. However, semantic.css itself imports some other fonts present on my server, which are then unable to load because of Cross-Origin resource sharing policy. This is the error message chrome gives me: Font from origin ' http://[::1] ' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost ' is

Calling stored procedure in codeigniter

馋奶兔 提交于 2019-11-27 13:17:13
问题 I am using latest codeigniter and trying to call stored procedure from my model. Also I am using mysqli as database driver. Now I am having an error when I call two stored procedures. Following is the error: Error Number: 2014 Commands out of sync; you can't run this command now call uspTest(); Filename: E:\wamp\www\reonomy-dev\system\database\DB_driver.php Line Number: 330 Note that when I call a single stored procedure it works fine. Here is the code for model. class Menus_model extends CI

How do I run CodeIgniter migrations?

那年仲夏 提交于 2019-11-27 10:07:33
问题 I know how to create them via http://codeigniter.com/user_guide/libraries/migration.html But once I've created my migration files, how do I run them? 回答1: I am not sure this is the right way to do it, But It works for me. I created a controller named migrate (controllers/migrate.php) . <?php defined("BASEPATH") or exit("No direct script access allowed"); class Migrate extends CI_Controller{ public function index($version){ $this->load->library("migration"); if(!$this->migration->version(

Cannot remove index.php from CodeIgniter URL

一世执手 提交于 2019-11-27 09:07:39
My directory structure is /var/www/CI/ with all the folders viz., application, system under the folder CI. Have created a .htaccess file under CI. Following is the code in .htacess. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|public|images|robots\.txt|css) RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> Still localhost/CI/blog gives 404 error. Can anyone guide as to where this rule is wrong? Please try the following At first, make sure you set the config file like the following.. $config['index