CodeIgniter Forums
url and config - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: url and config (/showthread.php?tid=3129)



url and config - El Forum - 09-12-2007

[eluser]wojtekk[/eluser]
i made in config dir web.php
Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
    $CI =& get_instance();
    $CI->load->helper('url');
    
    $config['dir_images'] = base_url().'images/';
?>

and in autoload.php
Code:
$autoload['config'] = array('web');

i did it like that because i dont think u should put anything more to config.php
i just want in one place directory (so icould change it easily) and just call
Code:
$this->config->item('dir_images')

I saw Assets Helper
but
structure of dirs on all pages not always the same
so
Code:
$config['dir_images'] = 'images/';
or
Code:
$config['dir_images'] = '/images/';
is correct

so add base_url() to link is the best solution
Correct me if im wrong and maybe there is other better solution