Orchardcms 在Orchard CMS中用url替换内容类型的详细信息模板
有人知道是否可以使用url替代模板覆盖ContentType的DisplayType模板吗?例如,是否可以覆盖模板: Content-Page.Detail.cshtml和Content-url-homepage-Page.Detail.cshtml?在玩了一会儿之后,情况似乎并非如此。有人知道我想实现的目标是否可能吗Orchardcms 在Orchard CMS中用url替换内容类型的详细信息模板,orchardcms,orchardcms-1.6,Orchardcms,Orchardcms 1.6,有人知道是否可以使用url替代模板覆盖ContentType的DisplayType模板吗?例如,是否可以覆盖模板: Content-Page.Detail.cshtml和Content-url-homepage-Page.Detail.cshtml?在玩了一会儿之后,情况似乎并非如此。有人知道我想实现的目标是否可能吗 谢谢 通过启用“形状跟踪”功能并查看备选形状列表,您可以查看形状的所有可用备选形状,例如: 例如,在主页的主要内容项上,我可以开箱即用: ~/Themes/MyTheme/Vie
谢谢 通过启用“形状跟踪”功能并查看备选形状列表,您可以查看形状的所有可用备选形状,例如: 例如,在主页的主要内容项上,我可以开箱即用:
~/Themes/MyTheme/Views/Content.cshtml
~/Themes/MyTheme/Views/Content-url-homepage.cshtml
~/Themes/MyTheme/Views/Content.Detail.cshtml
~/Themes/MyTheme/Views/Content-Page.cshtml
~/Themes/MyTheme/Views/Content-10.cshtml
~/Themes/MyTheme/Views/Content-Page.Detail.cshtml
~/Themes/MyTheme/Views/Content-10.Detail.cshtml
您可以选择添加或扩展现有的替代工厂,如Orchard.DesignerTools.Services.UrlAlternatesFactory,例如
// appends [ShapeType]__url__[Url]_[DisplayType] alternates
context.ShapeMetadata.Alternates = _urlAlternates.Value.Select(url =>
context.ShapeMetadata.Type + "__url__" + url + "_" +
context.ShapeMetadata.DisplayType)
.Union(context.ShapeMetadata.Alternates)
.ToList();
这将为您提供备选方案
~/Themes/myteme/Views/Content-url-homepage.Detail.cshtml
或使用现有备选方案之一,例如
~/Themes/MyTheme/Views/Content-10.Detail.cshtml
这看起来可能适合您的目的(对我来说,使用id不如使用url干净)
我还尝试调整“Url替代项”功能的功能优先级,以便Url替代项被附加到所有其他现有替代项上,正如代码中显示的那样,但据我所知,这不起作用或不受支持。为什么要这样做?任何URL上显示的内容都将以
详细信息
或摘要
模式显示,不能同时用于同一URL上的相同内容。。