Welcome Guest, Not a member yet? Register   Sign In
how to set new URL at config.php ?
#1

[eluser]Julia Yan[/eluser]
I want to set js, css path as same as $config['base_url'] at config.php

$config['js_url'] = $config['base_url'].'js/' ; //could not work?
#2

[eluser]cahva[/eluser]
You can and then use for example config_item('js_url') in the views. But ask yourself if its necessary as you can use these in the views:
Code:
< script src="<?=base_url() ?>js/script.js"></ script>

<!-- Or -->
< script src="<?=site_url('js/script.js') ?>"></ script>
#3

[eluser]Julia Yan[/eluser]
Thanks I mean how set the URL as
< script src="<?=js_url() ?>"></ script> instead of
< script src="<?=base_url() ?>js/script.js"></ script>
#4

[eluser]cmgmyr[/eluser]
If you want to use js_url() you will have to create it, probably in a helper function. So you can either do that, use the 2 examples that cahva made, or output the variable using:
Code:
$this->config->item('js_url');
#5

[eluser]danmontgomery[/eluser]
Code:
function js_url($file = '') { return site_url('js/'.$file); }




Theme © iAndrew 2016 - Forum software by © MyBB