• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CSS Folder in the Application Folder

I have used CI for a year or so and have done a few installs before and everything has worked fine. But I have been tasked by my new employer to set CI up to where there are multiple applications in the Applications folder. That too has worked fine.

But I am stuck with how to locate the CSS folder with multiple applications.

I used a suggestion from this page to create an asset_url() variable.

When I do that this is what I get:
<link rel="stylesheet" type="text/css" href="http://localhost/pso/application/pso/assets/css/pso_stylesheet.css" />

My directory is setup like this:

I am at the point where I have looked at this too much and I can't see what I am doing wrong.
Any suggestions would help.
Hopefully I have provided enough information, if not let me know.
Thanks in advance.

The assets folder has to be on the same level as index.php because of the .htaccess files in the application folder and other folders.

-- css
-- images
-- js
-- etc

<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/pso_stylesheet.css'); ?>" />

I knew there was going to be something I left out of my problem description.

The application/pso folder contains all the files and folders that are normally in the application folder. This is so I can have multiple separate apps.

In the application/pso/config/config.php base_url() is set as http://localhost/pso/. Which is correct because my test application works fine with it set that way.

So it doesn't work to move the assets folder out on the same level as index.php (my index.php and .htaccess are actually in my www folder) because it is trying to look in the pso folder which is how my base_url() variable is set.

This is what I get when I use base_url():
<link rel="stylesheet" type="text/css" href="http://localhost/pso/assets/css/pso_stylesheet.css" />

Again that is how I want it to work, but just don't know how to get it to see the asset folder in application/pso.

Then take a look at all the .htaccess files in the application and other folders and you will see why you cannot access them.

I am going to claim ignorance in the area of .htaccess files. I have modified the one located in the WWW folder, but that is all.

The .htaccess located in the /pso folder currently says Deny from all

What do I need to change in the .htaccess file in order to have access to /pso/assets/css?

Thanks Again!

You should restructure your applications so that you are not intermingling logic code with static assets.

-- pso/
---- application/
---- assets/
---- index.php
-- another_app/
---- application/
---- assets/
---- index.php

That way, the default .htaccess provided with CI will not interfere with your application functioning properly. You can then add your own .htaccess files for removing index.php in the manner you'd prefer.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.