We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Specifiying Images/CSS/JS in extensions/modules

Development and Programming

Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham
I was wondering if anyone gave this some extra thought (preferably the developers at EllisLab)? The ideal situation would be to have a directory called css/img/js in your module directory to simplify installation, but how does one get the path to that folder in a foolproof way? I intend to use this module I’m developing myself, but making things easier is never a bad thing…

There is no fool proof way unless you use the themes directory. I have rebuilt most of my extensions using this technique and it works well.

       
Wouter Vervloet's avatar
Wouter Vervloet
758 posts
16 years ago
Wouter Vervloet's avatar Wouter Vervloet

Hmmm… I might have found a way to include css and js files in the module directory.

$DSP->body .= '<style type="text/css">'.$DSP->file_open(PATH_MOD.'/'.$this->module_name'/css/cp.css').'</style>';

Same goes for js-files…

Any thoughts on this?

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

The main issue with that approach is that the pages will be much bigger to download and the browser cannot cache the resource.

       
Wouter Vervloet's avatar
Wouter Vervloet
758 posts
16 years ago
Wouter Vervloet's avatar Wouter Vervloet
The main issue with that approach is that the pages will be much bigger to download and the browser cannot cache the resource.

True… But for me this works for now, since I only intend to add only a few lines of css, but I wanted to keep it separate from my backend.

I guess it would be a bit much to ask the EE-developers to implement something like this in the current version since 2.0 is already on its way. Let’s just hope it gets easier in 2.0 😊

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.