Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
598 views
in Technique[技术] by (71.8m points)

css - CodeIgniter - Simple base_url question

I'm a bit confused here.

I have a simple controller which loads a view. The view contains a form and links some CSS files. I don't really want to do ../../css/global.cssin my link tag. I want to use the base_url() method and then go /css/.

I know a friend uses the following:

  <link href="{base_url}css/style.css" rel="stylesheet" type="text/css" />

However, I can't get that to work. He uses CodeIgniter 1.7 though, I'm using the latest (2.something) version. I'm new to CodeIgniter and I wanted to mess around with it, but I can't even link a simple CSS file :(

My view is in /logic/views/index.php, my css files are in /css/

Thanks a bunch.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

I put my css files in the root directory and link them like this

<?php echo link_tag('css/forie.css'); ?>  
<?php echo link_tag('css/reset.css'); ?>
<?php echo link_tag('css/main.css'); ?>

Using link_tag allows me to access them easily


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...