I'm building a a module and I am having trouble trying to load images for my css styles and views..

is there a way to do this?

file stucture: third_party:

  • module
    • javascript
    • css
    • views

I have tried '../images/file.png' but no go as obviously the path is incorrect on page render.

1 Answer 1


You'll need to use the themes folder to use assets like images. So use a file structure like this:


Then you can use ../images/my-image.png in your css files.

Use ee()->cp->add_to_head() to add the CSS to the CP's head-element.

Use ee()->cp->add_to_foot() to add any JS to the footer of the CP.

See also:

  • i was afraid that would be the answer.. will have to create an installer for the module then.. oh well.
    – 4razmus
    Commented Jun 14, 2013 at 11:41
  • also you can use: ee()->cp->load_package_css('main'); and ee()->cp->load_package_js('jquery-1.10.1.min'); to load css/js into the cp
    – 4razmus
    Commented Jun 14, 2013 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.