2

I've created a simple plugin based on the Craft docs with the following directory structure...

/craft
    /plugins
        /eforms
            /resources
                /js
                    public.js
            /templates
                /public
                    index.html
/public_html

In the index.html template of my plugin I'm using the following line to try to include the public.js file...

{% includeJsResource "eforms/js/public.js" %}

Which attempts to include the following resource in the browser

http://mydomain/eforms/js/public.js

Unfortunately this just gives me a 404. Does anyone have an idea of what I'm doing wrong?

| improve this question | | | | |
4

Think you need:

UrlHelper::getResourceUrl('path/to/file.ext')

There is more info over at http://buildwithcraft.com/docs/plugins/resources

Edit

ok, scrap that answer, I didn't read the rest of the help page :)

I think you are nearly there though. I'll have a test on my local machine and get back to you.

Edit 2

I believe I'm running into the same problem you have described as well. I did however get it working by doing this:

<script src="{{ resourceUrl('eforms/js/public.js') }}"></script>
| improve this answer | | | | |
  • I appreciate the effort but unfortunately this file needs to appear after a number of others so I must use the includeJsResource method. – michael Jul 29 '14 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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