Welcome Guest, Not a member yet? Register   Sign In
Loading Uri segements in config.php
#1

I have been trying to use on my config.php


PHP Code:
require_once(BASEPATH .'core/URI.php');

$URI = new CI_URI(); 

On my config.php for my sessions

PHP Code:
$config['sess_driver'] = 'files';

if (
$URI->segment(1) == 'admin') {

    
$config['sess_cookie_name'] = 'admin_sessions';
    
$config['sess_expiration'] = 1440;
    
$config['sess_save_path'] = FCPATH 'application/cache/session/admin/';

} else {

    
$config['sess_cookie_name'] = 'catalog_sessions';
    
$config['sess_expiration'] = 7200;
    
$config['sess_save_path'] = FCPATH 'application/cache/session/catalog/';

}

$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE

But comes up with this error

Code:
A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant UTF8_ENABLED - assumed 'UTF8_ENABLED'

Filename: core/URI.php

Line Number: 328

Backtrace:

File: C:\xampp\htdocs\project-1\application\config\config.php
Line: 371
Function: __construct

File: C:\xampp\htdocs\project-1\index.php
Line: 315
Function: require_once

Is there a better way so I can use URI segments in config.php
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB