Welcome Guest, Not a member yet? Register   Sign In
question about directory structure
#1

[eluser]杨帅[/eluser]
hi everyone, I'm new to codeigniter, but i found it very interesting. i wanna move my application to codeigniter. now i have a question, where should i put my css js and image files? i think i should make folders such as styles scripts or images under the system/application/views folder, right?
most appreciative of every advice.
#2

[eluser]Unknown[/eluser]
create some folders in root catalogue! named "js" "css" ,ect.
CSS: <link href="<?= base_url();?>css/XXX.css" rel="stylesheet" type="text/css" />
modify config.php to set base_url;

chinese:在根目录下建几个文件夹 把js css 放进去
引用css时加个base_url变量
base_url你可以在config.php中设定一下
其实就是引用了绝对路径!
#3

[eluser]esra[/eluser]
One method is to use the assets_helper file mentioned on the forums.

You can also use absolute urls in your template or master view using the base_url() function in URL helper. For example,

"<?=base_url();?>/assets/images/image.png"
"<?=base_url();?>/assets/css/style.css"
"<?=base_url();?>/assets/js/common.js"

The above assumes a directory structure like:

assets/
assets/css/
assets/images/
assets/js/
system/
index.php

You can also create your own helper with custom functions for your storage locations, but assets_helper already does this.

Some of the template libraries, such as YATS offer their own solutions for handling assets storage.
#4

[eluser]Unknown[/eluser]
china




Theme © iAndrew 2016 - Forum software by © MyBB