codeigniter-url

Custom URI routing by query string with CodeIgniter?

坚强是说给别人听的谎言 提交于 2019-12-11 01:54:20
问题 I am looking to make a custom route using the CodeIgniter framework. I am trying to make the URL like so: http://localhost/accounts/Auth.dll?signin So far I have tried adding the following to my routes.php config file: $route['accounts/Auth.dll?signin'] = "accounts/signin"; but as you would guess, it doesn't work. I have also tried escaping the characters like this: $route['accounts/Auth\.dll\?signin'] = "accounts/signin"; and that doesn't work either. I've also tried including the leading

how to include a file inside a model in codeigniter?

半腔热情 提交于 2019-12-10 18:50:36
问题 I’m new to codeigniter and maybe my question is a bit stupid but..I cant understand how I can include a file inside a model. Inside del model folder I’ve a subfolder named include and inside this I’ve some php file. The structure is something like that: -models —mymodel.php —include —-file.php —-file1.php Inside mymodel.php how I can include the file.php? I’ve heard that the relative path is allways the index.php, so I’ve tried: include ‘models/include/file.php’ but it seems not working. I’ve

Add URI Segment for Language in Codeigniter

喜你入骨 提交于 2019-12-10 11:05:42
问题 I have a site; I need to develop to support multiple languages, for example en, tr, ar, sp, etc. But the problem is , what is the best way to do it with Codeigniter? I have a controller ( SITE ). I have a lot of functions LIKE ( hotel , city , page , blog ) I want to before this method add a segment ( language ). This is old links http://example.com/hotel/mariot http://example.com/hotel/hilton http://example.com/city/london http://example.com/city/paris ... .. and I want the links to be like

array_unique showing error Array to string conversion

被刻印的时光 ゝ 提交于 2019-12-10 00:35:26
问题 For getting the unique values i am using unique values. Below is the code i am using array_unique($results_external); aasort($results_external,"created_on"); $returns_buy_external[]=array_reverse($results_external, true); If i use the code like this, below is the error i am getting A PHP Error was encountered Severity: Notice Message: Array to string conversion Filename: models/product_model.php Line Number: 3550 3550 line is array_unique($results_external); Can anyone help me, why it is

codeigniter redirect

ⅰ亾dé卋堺 提交于 2019-12-08 13:39:24
问题 My redirect is not working, I can see no reason why it is not working thouhg, can anyone see a reason, function createCookie() { $this->load->helper('url') // Function gets called when the user clicks yes on the firstTime menu. // The purpose of this function is to create a cookie for the user. // First we'll give them a unique ID // Set an expiration time $prefix = "bang"; $unique = uniqid($prefix); $expireAt = time() + (60*60*24*30); // With the unique ID now available we can set our cookie

Codeigniter ci_sessions table storing ip address as 0.0.0.0 why? even when hosted I am getting 0.0.0.0

前提是你 提交于 2019-12-08 05:04:40
问题 Hello in my codeigniter I have created table as ci_sessions with following fields CREATE TABLE IF NOT EXISTS `ci_sessions` ( session_id varchar(40) DEFAULT '0' NOT NULL, ip_address varchar(45) DEFAULT '0' NOT NULL, user_agent varchar(120) NOT NULL, last_activity int(10) unsigned DEFAULT 0 NOT NULL, user_data text NOT NULL, PRIMARY KEY (session_id), KEY `last_activity_idx` (`last_activity`) ); Every field is working fine, except ip address which is storing as 0.0.0.0 for every client. I have

CodeIgniter: Page not found when passing parameters to a controller?

社会主义新天地 提交于 2019-12-08 01:59:44
问题 I'm trying to pass parameters to a control in codeigniter, but I'm getting 404 page not found error, I don't get it, I did what the guide says: http://codeigniter.com/user_guide/general/controllers.html#passinguri When I remove the params in the index function and just access the controller everything works fine, but I can't pass a value to it... Here is the code the way I'm trying to send a param: http://mysite/123 <?php class Main extends Controller { function index($username) { echo

Codeigniter File Paths

有些话、适合烂在心里 提交于 2019-12-07 08:25:26
问题 sorry to bother but I am having some confusion with filepaths within codeigniter, as you may or may not know CI lays out its file system as follows: -application: -controllers -views -models -system(contains CI framework) I have created a css file and have some images saved in the a resources folder like so: -application: -controllers -views -models -system(contains CI framework) -resources -img001 -style.css I was wondering whether someone could point me in the right direction to accessing

CodeIgniter Paging 404

和自甴很熟 提交于 2019-12-06 22:34:32
I've checked several threads on here regarding paging in CodeIgniter but I haven't found a solution to my problem. I have a controller class located at controllers/admin/index.php called 'Index' that contains the following code: class Index extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper("url"); $this->load->helper( 'events_helper' ); $this->load->helper( 'delegates_helper' ); $this->load->model( 'admin/event_model' ); $this->load->model( 'admin/delegate_model' ); $this->load->library( 'pagination' ); } public function index() { $config =

CodeIgniter: Page not found when passing parameters to a controller?

牧云@^-^@ 提交于 2019-12-06 13:41:24
I'm trying to pass parameters to a control in codeigniter, but I'm getting 404 page not found error, I don't get it, I did what the guide says: http://codeigniter.com/user_guide/general/controllers.html#passinguri When I remove the params in the index function and just access the controller everything works fine, but I can't pass a value to it... Here is the code the way I'm trying to send a param: http://mysite/123 <?php class Main extends Controller { function index($username) { echo $username; } } ?> How can I get more info regarding this error from codeigniter? Thank you. With that URL,