$2sxc is not defined

点点圈 提交于 2019-12-11 16:59:21

问题


After adding Content module to a page, I just get a round blue icon with white glasses. Clicking on it produces an error in the console:

ReferenceError: $2sxc is not defined 1 ui.html:20:5
<anonymous> http://localhost/DotNetNuke/desktopmodules/tosic_sexycontent/dist/ng/ui.html:20:5

Clicking 'Change Template / Layout' in pencil menu also does nothing. This happened after upgrading from 2sxc 8.12 to 9.02. I checked the file and of course could not see $2sxc defined anywhere. I have installed on other sites and not had this problem, but it is failing on my localhost installation. DNN 9.1.1 I have tried uninstalling 2sxc and deleting all the Tosic... files I can find, then reinstalling, but I get the same results.

Similar to: Having some issues with 2sxc version 9.x: unable to select App/Content layout

Does anyone know how to fix this? Thx.


回答1:


So this was a bug in that version, it's fixed now.




回答2:


I fixed this after a little debugging and following the code. The problem happens on localhost implementations. There is a file: DesktopModules\ToSIC_SexyContent\dist\ng\ui.html that contains the code in a script container:

var
  path = window.location.pathname,
  isDevMode = window.location.hostname === 'localhost',
  apiUrl;

The problem is that it thinks it is in 'DevMode' when it is on localhost and therefore sets:

devPath = 'http://2sxc.dev/desktopmodules/tosic_sexycontent/dist/a4/';

which is certainly not a valid URL on my system, and apparently not on the web either. So the solution is to have it avoid 'DevMode' and everything works as it should. I did this by modifying the 'localhost' to be 'xlocalhost' and it worked like a charm. You could also just set it to false.



来源:https://stackoverflow.com/questions/45292362/2sxc-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!