0

I am working on a project that is using HMVC stucture for my codeigniter project and using an assets and template library to handle different assets and templates and themes. Its the libraries from PyroCMS. As of right now I'm hardcoding my values in as since.

I do have a little bit of a difference between my file structure and that of PyroCMS as they have a folder inside their system folder for that houses all of their application files.

Asset::add_path('theme', APPPATH . 'themes/mythem/assets/');
Asset::set_path('theme');

When I echo out the asset for my page for the current theme I'm using it shows up as

http://dev.mysite.com/application/themes/mytheme/assets/css/bootstrap/bootstrap.css 



application/
    themes/
        mytheme/
            assets/
                css/
                    whatever.css
assets/
    cache/
system/
public_html/
    index.php
Kevin Smith
  • 731
  • 2
  • 7
  • 21

1 Answers1

2

You can't access the application folder directly.

EDIT

You CAN access the application folder directly, but you really shouldn't. It's not safe because it allows direct access to your logic files (controllers, models, etc.). Refer to this question: CodeIgniter + CSS

Stick your assets folder outside of application and add it to your .htaccess file:

RewriteCond $1 !^(assets|other_toplevel_folders)
Community
  • 1
  • 1
Devin Young
  • 841
  • 7
  • 21
  • I made the mistake in the name above. In my code its application. WHat does that above code do? – Kevin Smith Mar 14 '13 at 20:45
  • I figured so. You should edit your post. You will need to move your assets folder outside as a top-level directory. This will allow the files to be directly accessible by the server. The code I provided goes in your .htaccess file and tells the server it is allowed to access that top-level folder directly. – Devin Young Mar 14 '13 at 20:47
  • I'm looking at a CMS that uses the same kind of hmvc and they have that same sort of file structure and it allows them to use it. – Kevin Smith Mar 14 '13 at 20:49
  • I am using an asset library includes that ../assets/cache folder. Is that okay? – Kevin Smith Mar 14 '13 at 21:04
  • Which asset library is it? And why are there two asset folders? – Devin Young Mar 14 '13 at 21:14
  • I updated my post. The two asset folders where the centralized just for that theme and the main one is more for a global asset folder in case I had files that are used all across my site that wasn't theme specific. – Kevin Smith Mar 14 '13 at 21:16
  • The difference between this and PyroCMS is that PyroCMS separates the business logic from the addons, i.e., themes, plugins, etc. It even has the Codeigniter installation in a completely separate directory. You should consider a similar structure, as it will be easier for you to extend CI, AND be more secure. – Devin Young Mar 14 '13 at 21:23