放置图像/ css / js在views文件夹(codeigniter) [英] place images/css/js in views folder (codeigniter)

查看:142
本文介绍了放置图像/ css / js在views文件夹(codeigniter)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个有用户和管理员的小项目。在我的控制器文件夹中有两个文件夹管理员和用户。类似地,在我的视图文件夹中有两个文件夹管理员和用户。管理和用户端都有不同的模板。我把CSS / Images / JS放在资源文件夹中,放在根文件夹(平行于系统文件夹)。我不想在资源文件夹中为管理员和用户创建两个不同的文件夹。相反我想要的是在views / admin和views / user文件夹中放置相应的css / js / images。这样我可以删除assets文件夹和所有的html / css /图像等将在同一个文件夹,我将能够使不同的主题为用户端。是否可以??如果是如何??请详细指导我。

I am developing a small project that has user and admin sides. In my controllers folder there are two folders admin and user. Similarly in my views folder there are two folders admin and user. Both admin and user ends have different templates. I have placed CSS/Images/JS in assets folder that is placed in root folder (parallel to system folder). I do not want to make two different folders in assets folder for admin and user. Instead what i want is to place respective css/js/images in views/admin and views/user folders. This way i can remove assets folder and all html/css/images etc will be in same folder and i will be able to make different themes for user side. Is it possible?? If yes how?? Please guide me in detail.

编辑:我想在application / views / admin和user.css中的application / views / users中放置admin.css

edit: I want to place admin.css in application/views/admin and user.css in application/views/users

推荐答案

任何想要在视图中放置所有css / js /图片的人都可以尝试。

anyone who want to place all css/js/images in views can try this.

例如,您希望将css文件放在views文件夹中,您将给予此文件的CSS文件路径

for example you want to place css file in views folder you will give CSS file path like this

href="<? echo base_url() ?>application/views/assets/css/admin.css"

现在你将被禁止访问错误。此错误是应用程序文件夹中的.htaccess文件的原因。打开.htaccess文件并复制粘贴以下内容。

now you will get forbidden access error. This error is cause of .htaccess file in application folder. open .htaccess file and copy paste following.

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]  

您已准备好了。

这篇关于放置图像/ css / js在views文件夹(codeigniter)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆