가 만든 초기화 모듈EPiServer 7 MVC IDisplayModes
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class DisplayModesInitialization : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
if (context.HostType == HostType.WebApplication)
{
System.Web.WebPages.DisplayModeProvider.Instance.Modes.RemoveAt(0);
context.Locate.DisplayChannelService()
.RegisterDisplayMode(new DefaultDisplayMode(RenderingTags.Mobile)
{
ContextCondition = (r) => r.Request.Browser.IsMobileDevice
});
}
}
public void Preload(string[] parameters) { }
public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context) { }
}
를 링크
을 따르고 당신이 볼 수 있듯이, 기존의 "모바일"디스플레이 모드를 EPiServer Displ을 통해 생성 된 디스플레이 모드로 대체하려고 시도했습니다. ayChannelService(). 그냥 홈페이지에 검색
이 작품을 좋아하지만 모바일 브라우저로 사용자 에이전트를 강제로 할 때, 즉이 나타나는 그러나 Index.mobile.cshtml
여전히 _Layout.cshtml
대신 _Layout.mobile.cshtml
의 찾고 될 ... 정확한보기를 누르 않습니다 심지어 그것을 발견하지 못한다.
The file "~/Views/Shared/_Layout.cshtml" could not be rendered, because it does not exist or is not a valid page.
누구나 성공적으로 EPiServer DisplayChannelService
을 통해 MVC에 대한 모바일 IDisplayMode
을 만들? 내가 명시 적으로 모바일보기
@{
Layout = "~/Views/Shared/_Layout.mobile.cshtml";
}
의 레이아웃을 설정하는 경우
또한 또한을 찾기 위해 실패하면?
The file "~/Views/Shared/_Layout.mobile.cshtml" could not be rendered, because it does not exist or is not a valid page.
_Layout 및 _Layout.mobile 모두 해당 위치에 존재합니까?