2

I'm using Craft in a multilingual setup with the Smart Map plugin. However, the CSS and JavaScript files are not being linked properly when the site isn't in the main language.

For some reason, the paths to the plugin resources contain the language prefix:

/en/cpresources/smartmap/css/smartmap.css

Is this normal behaviour? How can it be fixed?

2
  • Let me ask you this... Do you have any other plugins that have built-in CSS or JS? If so, are those other plugins experiencing the same problem? I'm just trying to diagnose if the issue is on the Craft side or the Smart Map side.
    – Lindsey D
    Jul 6 '14 at 4:21
  • I have only smartmap and contact form plugin. Contact form plugin doesn't seem to require js or css
    – maunoxyd
    Jul 6 '14 at 9:07
2

Good question... As far as I know, the plugin's resource paths should not include the localization prefix. The resources are being called via PHP in the most direct way possible:

craft()->templates->includeJsResource('smartmap/js/smartmap.js');
craft()->templates->includeCssResource('smartmap/css/smartmap.css');

I'm not entirely sure, but I suspect this may be a Craft bug. I've reached out to Pixel & Tonic in order to fully diagnose the problem. If the plugin code needs to be corrected, I will implement a fix as soon as we can figure out what's going on.

2

When Craft generates a “resource URL” from a front-end request, it just takes whatever the current site URL is, adds the resourceTrigger config setting (“cpresources”), and then adds the path that was passed in (“smartmap/js/smartmap.js” for example).

So if your site URL is “/en”, then that’s going to be part of the resulting resource URL.

As long as there’s a working Craft index.php file at /en/index.php, and you’re able to serve regular front end pages from that base URL, then there’s no reason the “en/” part should be tripping anything up when serving resources.

All of the CP’s front-end resources are served through the same mechanism – try going to /en/admin (or whatever your cpTrigger is set to) and seeing if the CP is working normally from there.

2
  • Nope, blank page
    – maunoxyd
    Jul 6 '14 at 14:32
  • 1
    In that case the issue is bigger than just a couple of plugin resource URLs. We can help you look into it if you send the URLs and FTP credentials over to support@buildwithcraft.com (and include this page's URL for reference). Jul 6 '14 at 14:52

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.