codeigniter-3

Codeigniter: how to remove index.php from URL?

帅比萌擦擦* 提交于 2019-12-10 11:56:55
问题 I've looked at many articles and tried different ways but it still doesn't work. Now my URLs look like mysite.com/index.php/[controller] . The goal is mysite.com/[controller] . In config.php : $config['index_page'] = ""; $config['uri_protocol'] = 'REQUEST_URI'; My .htaccess file contains RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] Also mod_rewrite is enabled

Error: while login and logout using codeigniter [duplicate]

非 Y 不嫁゛ 提交于 2019-12-10 11:38:58
问题 This question already has answers here : Codeigniter pressing logout button and disable the back browser button (4 answers) Closed last year . The login and logout is working fine but, after getting logout from the page im still able to access that page, for example in url if i use as codeigniter_try/index.php/Home/backend its displaying the page which should not happen, i mean to say it should display only when i loggedin with the username and password. what issue im facing here can any one

How to fetch title of an item from a database and send it to the header template in CodeIgniter

喜夏-厌秋 提交于 2019-12-09 14:05:58
问题 I am writing an application in CodeIgniter where I specify the <title> meta-tag on every page in every controller which I have managed to send to my header template. However, now I have created an application that fetch credit cards and their titles from the database, through an CodeIgniter model. I would like to automatically fetch and use the credit card's name in <title> so that i don't need to change it manually, but I'm a little stuck on how to proceed. This is my code as of now:

How to upload multiple image with validation in CodeIgniter

北战南征 提交于 2019-12-09 13:56:06
问题 I'm trying to upload multiple images with validation but not able to do so. My view code is as below:- <?php echo form_open("controller/action");?> <ul> <li>Category Image <input type="file" name="category_img"></li> <li>Product Image <input type="file" name="product_img"></li> <li>Slider Image <input type="file" name="slider_img"></li> </ul> <input type="submit" name="submit" class="btn" value="Submit" /> <?php echo form_close();?> Looking forward for a solution. 回答1: Doing it in your way,

Need string formation with space in php

筅森魡賤 提交于 2019-12-08 14:20:40
问题 $string='to kill a mocking bird'; Need output like below format Output: '"To kill a mocking bird", "Tokill a mocking bird", "Tokilla mocking bird", "Tokillamocking bird", "Tokillamockingbird", ,"To kill a mockingbird" ,"To kill amockingbird" ,"To killamockingbird"'; I used below Script $array = is_string($arg) ? str_split($arg) : $arg; if(1 === count($array)) return $array; $result = array(); foreach($array as $key => $item) foreach(permute(array_diff_key($array, array($key => $item))) as $p)

num_rows() not returning correct number of row when result is not empty

ぐ巨炮叔叔 提交于 2019-12-08 12:15:29
问题 I am working on one Join query in CodeIgniter. Query run perfectly fine. The problem is $query->num_rows() .This is how I write my join query. $this->db->select('related colums'); $this->db->from('table1 as t1'); $this->db->join('table2 as t2', 't1.id = t2.id', 'left outer'); $this->db->join('table3 as t3', 't1.id_second = t3.id', 'left outer'); $this->db->where('t1.column', $some_varibale); $this->db->order_by("t1.column", "desc"); $query = $this->db->get(); $query_result = $query->result

Codeigniter - Access Models And Database on Routing

五迷三道 提交于 2019-12-08 07:54:27
问题 I'm Planning to make a project in codeigniter 3.0.3 and I want to use routing like below. 1) . www.mydomain.com/categoryNamehere 2) . www.mydomain.com/postNameHere I have a separate table in my database to keep category names with their unique id's. What I want is when a user click on a link like www.mydomain.com/xxxxx 1.first check on category table (xxxxx) 2. if no match send it (xxxxx) to post controller. How can I implement this on Codeigniter 3.0.3 ? I tried to access my models in config

Codeigniter application: how can I display pagination as JSON?

混江龙づ霸主 提交于 2019-12-08 06:58:39
问题 I am working on a blog application with Codeigniter 3.1.8 . Currently, its admin area is well separated from the frontend. In the frontend, I have managed to replace "classic" Codeigniter views with JSONS. (the JSONS are displayed and "handled" with AngularJS). Here is the code in the controller for all the posts : private function _initPagination($path, $totalRows, $query_string_segment = 'page') { //load and configure pagination $this->load->library('pagination'); $config['base_url'] = base

Codeigniter email sending is not working [duplicate]

孤人 提交于 2019-12-08 06:20:12
问题 This question already has answers here : PHP mail function doesn't complete sending of e-mail (27 answers) Closed 2 years ago . I'm trying to send an email with an codeigniter contact us form but its not sending the email. Yes I know this question has been asked before but I just want to know if I don't have any wrong code. This is my controller file (Contactform.php) : <?php error_reporting(-1); ini_set('display_errors', 'On'); set_error_handler("var_dump"); error_reporting(E_ALL); ini_set(

Codeiginter product worked well in localserver without index.php but not worked in server

核能气质少年 提交于 2019-12-07 19:13:49
问题 I have created one project in codeiginiter That was worked in local server without index.php (localhost/sample) But when i up-ed into online server(cpanel linux) the default controller only worked , other next page URLs are not worked.. (https://sample/nextpage) if i give index.php means worked (https://sample/index.php/nextpage) i want to remove index.php , please help me.. my config.php $config['index_page'] = 'index.php'; $config['uri_protocol'] = 'REQUEST_URI'; my route.php file $route[