Kevin Smith
Kevin Smith

Reputation: 731

Loading Assets from inside of theme folder

In trying to find out how to have the following work. I have the template library located here and I'm trying to figure out how I can have the dashboard look for the images/css/js files in the file structure below as opposed to the regular assets folder in the public_html folder since those files only pertain to that theme.

https://github.com/philsturgeon/codeigniter-template

/application
   /themes
      /supr
          /views
              dashboard.php
          /assets
             /js
             /css
             /images
/public_html
    /assets
        /js
        /css
        /images
    index.php

Anybody else have any ideas?

Upvotes: 0

Views: 366

Answers (2)

FDisk
FDisk

Reputation: 9446

I'm using the same library with some modifications: https://github.com/FDiskas/MightMedia_TVS/

With structure I'm happy:

/themes
    /demo
        /views
            /mobile
            /web
                /layouts
                /modules
                /partials
                /resources
                    /css
                    /img
                    /js

In production all this css and js file are combined and compressed in to the application/resource/compiled folder

demo here: http://pac.lt/en.html

Upvotes: 0

Sergey Telshevsky
Sergey Telshevsky

Reputation: 12217

You better restructure that, that is not possible to achieve on Apache servers as mod_rewrite does not allow rewriting outside of the directory (one or more levels up) and you'll have to read a bunch of docs on nginx to do that if you're not familiar with rewrites. You can try to make CodeIgniter do it for you by checking if file exists in your themes folder and rendering it to output, but that will be a hell of a performance decrease as every image will call CI and will eventually rise bugs in your app.

I suggest you to use this structure instead:

/application
   /themes
      /supr
          /views
              dashboard.php
/public_html
    /assets
        /js
        /css
        /images
        /themes
            /supr
                /js
                /css
                /images
            /kewl_theme2
                /js
                /css
                /images

Upvotes: 2

Related Questions