Error CodeIgniter : A PHP Error was encountered Severity: Warning Message: mkdir(): Invalid path Filename: drivers/Session_files_driver.php Line Number: 117

Malam ini saya ada error di aplikasi codeigniter saya :

A PHP Error was encountered

Severity: Warning

Message: mkdir(): Invalid path

Filename: drivers/Session_files_driver.php

Line Number: 117

 

Dan setelah browsing nemu caranya yaitu :

  1. Masuk ke file config.php di application/config/config.php
  2. ubah settingan
    $config['sess_save_path'] = null 
    menjadi 
    $config['sess_save_path'] = sys_get_temp_dir();

 

Dan Alhamdulillah solved…..

 

Referensi :

http://stackoverflow.com/questions/31042456/when-i-want-to-use-session-in-codeigniter-it-says-error-why

PHP – Cara Menghilangkan %20 di URL Menjadi Spasi

Untuk menghilangkan %20 di url menjadi spasi di PHP menggunakan syntax rawurldecode, bila diterapkan di codeigniter :

$string_url = $this->uri->segment(3);

echo rawurldecode($string_url);

Bisa juga memakai

urldecode($string_url);

Awalnya saya menggunakan trik preg_replace :

$string_url = $this->uri->segment(3);

echo preg_replace(‘/%20/’, ‘ ‘, $string_url);

keduanya bisa digunakan , hanya saja cara pertama lebih efisien karena fungsi built in php dan cara kedua adalah trik karena belum ketemu yang pertama

sumber  :

http://php.net/manual/en/function.urldecode.php

http://php.net/manual/ro/function.rawurldecode.php

http://php.net/manual/ro/function.preg-replace.php

CodeIgniter Error : Only variable references should be returned by reference

Setelah Install php terbaru versi 5.6.5  saya menjalankan aplikasi php saya ada error :

A PHP  Error Was Encountered

Severity : Notice

Message : Only variable references should be returned by reference

Filename : Core/Common.php

Line Number : 257

Padahal sebelumnya tidak ada error

Setelah browsing2 akhirnya saya ubah kodenya :

dari :

return $_config[0] =& $config;

Menjadi :

return $config;

Dan Alhamdulillah berjalan normal seperti biasa tanpa error ….

Referensi :

http://indrayn.com/codeigniter-message-only-variable-references-should-be-returned-by-reference/

Callback Form Validation Tidak jalan di HMVC CodeIgniter

Setelah mencari setengah hari akhirnya ketemu juga

Function Callback di Form Validation tidak jalan meski saya baca di user guide CI  :

http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#callbacks

Itu karena saya memakai HMVC

Akhirnya setelah browsing2 nemu, nemunya di sumber nya HMVC  :

1. pertama :

Buat file : MY_Form_validation.php di lokasi application/libraries/MY_Form_validation.php

<?php
/** application/libraries/MY_Form_validation **/
class MY_Form_validation extends CI_Form_validation
{
public $CI;
}

2. kemudian buat satu file sebagai extends MX_Controller

<?php
class Xyz extends MX_Controller
{
function __construct()
{
parent::__construct();

$this->load->library(‘form_validation’);
$this->form_validation->CI =& $this;
}
}

Akhirnya form saya berjalan seperti apa yang saya harapkan

It works

sumber :

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc

Membuat Pagination Twitter Bootstrap di CodeIgniter

Untuk membuat Pagination Twitter Bootstrap di CodeIgniter  :

Buat file .php dan letakkan di folder application/config/

<?php  if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’);
/**
* Pagination Config
*
* Just applying codeigniter’s standard pagination config with twitter
* bootstrap stylings
*
* @license        http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
* @author        Mike Funk
* @link        http://codeigniter.com/user_guide/libraries/pagination.html
* @email        mike@mikefunk.com
*
* @file        pagination.php
* @version        1.3.1
* @date        03/12/2012
*
* Copyright (c) 2011
*/

// ————————————————————————–

// $config[‘base_url’] = ”;
$config[‘per_page’] = 2;
$config[‘uri_segment’] = 3;
$config[‘num_links’] = 9;
$config[‘page_query_string’] = TRUE;
// $config[‘use_page_numbers’] = TRUE;
$config[‘query_string_segment’] = ‘page’;

$config[‘full_tag_open’] = ‘<div class=”pagination”><ul>’;
$config[‘full_tag_close’] = ‘</ul></div><!–pagination–>’;

$config[‘first_link’] = ‘&laquo; First’;
$config[‘first_tag_open’] = ‘<li class=”prev page”>’;
$config[‘first_tag_close’] = ‘</li>’;

$config[‘last_link’] = ‘Last &raquo;’;
$config[‘last_tag_open’] = ‘<li class=”next page”>’;
$config[‘last_tag_close’] = ‘</li>’;

$config[‘next_link’] = ‘Next &rarr;’;
$config[‘next_tag_open’] = ‘<li class=”next page”>’;
$config[‘next_tag_close’] = ‘</li>’;

$config[‘prev_link’] = ‘&larr; Previous’;
$config[‘prev_tag_open’] = ‘<li class=”prev page”>’;
$config[‘prev_tag_close’] = ‘</li>’;

$config[‘cur_tag_open’] = ‘<li class=”active”><a href=””>’;
$config[‘cur_tag_close’] = ‘</a></li>’;

$config[‘num_tag_open’] = ‘<li class=”page”>’;
$config[‘num_tag_close’] = ‘</li>’;

// $config[‘display_pages’] = FALSE;
//
$config[‘anchor_class’] = ‘follow_link’;

// ————————————————————————–

/* End of file pagination.php */
/* Location: ./bookymark/application/config/pagination.php */

Untuk

$config[‘per_page’] = 2;
$config[‘uri_segment’] = 3;
$config[‘num_links’] = 9;
$config[‘page_query_string’] = TRUE;

Bisa disesuaikan dengan kebutuhan kita

Sumber :

gist.github.com/mikedfunk/3504432#file-pagination-php