0

我希望将“lightbox2”(http://lokeshdhakar.com/projects/ligh..)集成到我正在开发的 DNN 模块中,这涉及在 Lightbox2 附带的 dnn 项目中使用 4x js 和 css 文件。

我已按照此处的资源客户端管理 API 指南 ( http://www.dotnetnuke.com/Resources/Wiki/Page/Client-Resource-Management-API.aspx ) 尝试在我的模块中进行设置。不幸的是,当我在本地机器上运行该模块时,我不断收到错误消息:

Error: TestModule is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: The server tag is not well formed. ---> System.Web.HttpParseException: The server tag is not well formed. ---> System.Web.HttpException: The server tag is not well formed. at System.Web.UI.TemplateParser.ProcessError(String message) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at DotNetNuke.UI.Modules.WebFormsModuleControlFactory.CreateModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration) at DotNetNuke.UI.Modules.ModuleControlFactory.LoadModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration) at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace ---

我在 ascx 页面(不是代码)中工作,到目前为止我的脚本是:

<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>

<dnn:DnnJsInclude runat="server" FilePath="FilePath="~/DesktopModules/TestModule/js/jquery-1.7.2.min.js" PathNameAlias="SkinPath" />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/TestModule/js/jquery-1.7.2.min.js" PathNameAlias="SkinPath" />
<dnn:DnncssInclude runat="server" FilePath="~/DesktopModules/TestModule/css/lightbox.css" PathNameAlias="SkinPath" />
<dnn:DnncssInclude runat="server" FilePath="~/DesktopModules/TestModule/css/screen.css" PathNameAlias="SkinPath" />

我在几个论坛上搜索了答案,但没有太多帮助。一个类似的问题是here(How to add a Lightbox to a custom DotNetNuke module),但对于像我这样的javascript新手并没有详细说明

如果有人能在这里指出我正确的方向,将不胜感激

非常感谢

4

2 回答 2

1

您的第一个包含行重复: FilePath="FilePath="~

删除第二个 FilePath="

评论后的编辑:

你加载了 jQuery 两次,所以我假设其中一个应该加载你的灯箱插件(一旦第一行被更正,这些是你的前两行):

<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/TestModule/js/jquery-1.7.2.min.js" PathNameAlias="SkinPath" />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/TestModule/js/jquery-1.7.2.min.js" PathNameAlias="SkinPath" />

另外,我没有尝试过以这种方式加载它,但我感觉像这样加载 jQuery 可能会加载两次(可能是两个不同的版本)。尝试使用:

DotNetNuke.Framework.jQuery.RequestRegistration();

反而。

于 2013-05-23T19:51:49.437 回答
0

我在我当前的项目中使用这些东西,它工作正常。我可以看到你和我之间唯一不同的是我不使用 PathNameAlias="SkinPath" 属性。

交叉检查的一个好方法是打开包含您的模块的页面的源代码,然后按名称搜索 javascript 文件或 css 文件。如果它在那里,请检查路径是否正确,如果它不在那里,那么你有问题。

当我编写自己的脚本时,我通常从 alert('here') 开始,以确保它们被包含在内。您可以暂时将其添加到灯箱 js 文件的开头。

标记

于 2013-05-24T17:39:40.913 回答