irisRoyalty 发表于 2011-7-4 21:14:48

css 不能正常显示(路径错误)

我在CI 中使用了 smarty 并且通过RewriteRule去掉了index.php

我再控制类的index方法中和另外一个AAA函数中分别调用display(view.tpl);
1、http://localhost/test访问显示正常
2、http://localhost/test/AAA 显示不正常 查看css路径中多了一个test

css存放路径为 localhost/template/default/css/
config 中设置base_url为http://localhost

css 访问<link type="text/css" rel="stylesheet" href="templates/default/css/html-style.css"/>

求助高手 为什么显示不正常呢,我是不是哪里少设置了什么东西?


muyeyifan 发表于 2011-7-5 01:19:55

<link type="text/css" rel="stylesheet" href="templates/default/css/html-style.css"/>
写成<link type="text/css" rel="stylesheet" href="<?php echo base_url()?>templates/default/css/html-style.css"/>
templates是根目录的

visvoy 发表于 2011-7-5 10:22:35

ls正解,css/js/图片要用绝对路径

irisRoyalty 发表于 2011-7-5 10:39:45

ls 以及ls的ls两位:可是我的link是写在.tpl中的啊难道每次都要assign一下么

我用控制器默认的index方法时 css是正确的为什么不用默认的index方法的时候会在css路径上加上控制器名
页: [1]
查看完整版本: css 不能正常显示(路径错误)