codeigniter-2

CodeIgniter: setting flash data not working

删除回忆录丶 提交于 2019-12-19 11:30:06
问题 I'm using the following code to manage pagination in search results: if ($this->input->post('search-notes') && (is_string($this->input->post('search-notes')) || is_string($this->input->post('search-notes')))): $this->session->set_flashdata('search-notes', $_POST['search-notes']); $post['search-notes'] = $this->input->post('search-notes'); elseif ($this->session->flashdata('search-notes')): $this->session->set_flashdata('search-notes', $this->session->flashdata('search-notes')); $post['search

HMVC codeigniter works on local server but not on web server

左心房为你撑大大i 提交于 2019-12-19 10:06:47
问题 this is killing me what do i have? CI version: 2.1.4 Modular Extensions - HMVC by wiredesignz a basic codeigniter(hmvc) project that works fine with the setting it has in local server(mamp) with php 5.5.3 my problem after i move the project to public web server i changed the following things. ——application/config/config.php $config['base_url'] = 'http://example.com/'; ——application/config/database.php $db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'newdbusername'; $db[

codeigniter base_url inside constants file

帅比萌擦擦* 提交于 2019-12-19 09:24:43
问题 Currently I display images in the following way: <img src="<?php echo base_url().USER_UPLOAD_URL.$post['userPhoto'] ?>" /> USER_UPLOAD_URL is defined inside application/config/constants.php. define('USER_UPLOAD_URL', "uploads/user_uploads/"); Is there any way to include base_url() inside constants.php? In this way I wouldn't need to write each time base_url() inside view. Is there any alternative approach? tnx 回答1: constants.php loading before config.php, so you can't use $config['base_url']

Setting up codeigniter in Dreamweaver CS 5.5

被刻印的时光 ゝ 提交于 2019-12-19 04:49:11
问题 I am looking for information on how to set up a code igniter project in Dreamweaver CS 5.5 with code hinting like you can for Zend framework. 回答1: I have managed to set code igniter up in Dreamweaver CS5.5 by downloading the latest version of code igniter and placing in a folder called php_librarys on the root of my C: drive. I then followed the instructions for site specific code hinting here: How to set up site specific code hinting. The folder you need to point Dreamweaver to is the

Running multiple queries in model in codeigniter

僤鯓⒐⒋嵵緔 提交于 2019-12-19 03:18:13
问题 I have this code in model in codeigniter: <?php Class Mymodel Extends CI_Model { function __construct() { parent::__construct(); } function search($textinput) { $street = "select street from dataSearch;"; $stripNameWOSpace = "select stripNameWOSpace FROM dataSearch;"; $vowels = array('a','e','i','o','u',';','/','-', ' '); $string = strtolower($textinput); $strippedVowels = mysql_real_escape_string(str_replace($vowels, '', $string)); $this->db->query("select dataSearch.id, dataSearch.name,

IonAuth - seems to be randomly logging me out

送分小仙女□ 提交于 2019-12-18 11:35:39
问题 I'm using ionAuth & it seems to be logging me out almost randomly? I'm using Codeigniter v2.1.4 - it logs in perfect fine however ionAuth seems to log out at random intevals, is there a way to force the session to stay active until I call the ionAuth->logout function? My CI config looks like as follows: $config['sess_cookie_name'] = 'cisession'; $config['sess_expiration'] = 7200; $config['sess_expire_on_close'] = FALSE; $config['sess_encrypt_cookie'] = FALSE; $config['sess_use_database'] =

codeigniter sess_destroy() not working properly,what m i doing wrong?

丶灬走出姿态 提交于 2019-12-18 07:44:51
问题 I am a newbie in codeigniter. I am using an an login form to login as an admin. When the admin logs in with the correct user name and password s/he is directed to the home page with a session variable.and then if he clicks the log out button the session is supposed to be destroyed and redirect the user to log in page i.e log in form page. The 1st controller is admin: <?php class Admin extends CI_Controller { function index() { $data['main_content'] = 'admin/log_in'; $this -> load -> view(

Codeigniter & HTML5 - Trying to Upload Multiple Images at Once

一个人想着一个人 提交于 2019-12-17 18:48:42
问题 View Looks Like This <?=form_open_multipart('upload/process');?> <input type="file" multiple="multiple" name="userfile[]" id="userfile" /> <?=form_submit('upload', 'Upload');?> <?=form_close();?> i want the user to be able to upload multiple images at once. once uploaded i want to make an entry of the image details in the database, and finally move the image to the uploads folder. i have basic knowledge of codeigniter ps: i dont want to use uploadify or similar image uploading plugins. trying

CodeIgniter: INSERT multiple records without cycle

早过忘川 提交于 2019-12-17 18:46:32
问题 It's possible to use multiple INSERT records in CodeIgniter Active Record without for, foreach and etc. ? My current code: foreach($tags as $tag) { $tag = trim($tag); $data = array( 'topic_id' => $topic_id, 'user_id' => $user_id, 'text' => $tag ); $this->db->insert('topic_tags', $data); } 回答1: Codeigniter active record has a function insert_batch i think that is what you need $data = array( array( 'title' => 'My title' , 'name' => 'My Name' , 'date' => 'My date' ), array( 'title' => 'Another

Always show Previous & Next links using CodeIgniter Pagination Class

安稳与你 提交于 2019-12-17 18:44:10
问题 Problem Description When I'm at the first page, the previous link is not showing up and so do the next link when I'm at the last page. I set $config['prev_link']='previous' and $config['next_link']='next' . Question How to always present, using the CodeIgniter pagination class, the Previous and Next links as <p> tags when they are not in used? Update End up Solving it myself. See solution below. Working on v2.1.3 回答1: Here is the Solution: Extend Codeigniter pagination class by creating a new