用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3395|回复: 3
收起左侧

[已过期] css 不能正常显示(路径错误)

[复制链接]
发表于 2011-7-4 21:14:48 | 显示全部楼层 |阅读模式
我在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"/>

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


发表于 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是根目录的
发表于 2011-7-5 10:22:35 | 显示全部楼层
ls正解,css/js/图片要用绝对路径
 楼主| 发表于 2011-7-5 10:39:45 | 显示全部楼层
ls 以及ls的ls两位:  可是我的link是写在.tpl中的啊  难道每次都要assign一下么

我用控制器默认的index方法时 css是正确的  为什么不用默认的index方法的时候会在css路径上加上控制器名

本版积分规则