Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am creating a web page and trying to access a stylesheet which is inside a "application/css/" folder. So how we can access this file and what helper function should use? Below is the head section I used in php file.

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Home</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</head>

If I use base_url('css/style.css') or link_tag('css/style.css'), it is returning url like 'http://localhost/test/css/style.css' which does not return path of css file.'http://localhost/test' is the base url.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
158 views
Welcome To Ask or Share your Answers For Others

1 Answer

It is Not Recommended that you have css or images in applications folder

Create a assets folder in main directory

application
assets
assets > css
assets > images
assets > js
system
index.php

On view use example <?php echo base_url('assets/css/stylesheet.css');?>

Autoload the url helper also.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...