Example #1
0
        public IViewEngine CreateModulesViewEngine(CreateModulesViewEngineParams parameters)
        {
            var areaFormats = new[]
            {
                "~/Core/{2}/Views/{1}/{0}.php",
                "~/Modules/{2}/Views/{1}/{0}.php",
                "~/Themes/{2}/Views/{1}/{0}.php",
            };

            var universalFormats = parameters.VirtualPaths
                                   .SelectMany(
                x => new[]
            {
                x + "/Views/{0}.php",
            })
                                   .ToArray();

            var viewEngine = new PhpViewEngine(_phpRuntimeWork)
            {
                MasterLocationFormats          = DisabledFormats,
                ViewLocationFormats            = universalFormats,
                PartialViewLocationFormats     = universalFormats,
                AreaMasterLocationFormats      = DisabledFormats,
                AreaViewLocationFormats        = areaFormats,
                AreaPartialViewLocationFormats = areaFormats,
            };

            return(viewEngine);
        }
Example #2
0
        public IViewEngine CreateThemeViewEngine(CreateThemeViewEngineParams parameters)
        {
            var partialViewLocationFormats = new[]
            {
                parameters.VirtualPath + "/Views/{0}.php"
            };

            var areaPartialViewLocationFormats = new[]
            {
                parameters.VirtualPath + "/Views/{2}/{1}/{0}.php"
            };

            var viewEngine = new PhpViewEngine(_phpRuntimeWork)
            {
                MasterLocationFormats          = DisabledFormats,
                ViewLocationFormats            = DisabledFormats,
                PartialViewLocationFormats     = partialViewLocationFormats,
                AreaMasterLocationFormats      = DisabledFormats,
                AreaViewLocationFormats        = DisabledFormats,
                AreaPartialViewLocationFormats = areaPartialViewLocationFormats,
                ViewLocationCache = new ThemeViewLocationCache(parameters.VirtualPath),
            };

            return(viewEngine);
        }
        public IViewEngine CreateThemeViewEngine(CreateThemeViewEngineParams parameters)
        {
            var partialViewLocationFormats = new[]
            {
                parameters.VirtualPath + "/Views/{0}.php"
            };

            var areaPartialViewLocationFormats = new[]
            {
                parameters.VirtualPath + "/Views/{2}/{1}/{0}.php"
            };

            var viewEngine = new PhpViewEngine(_phpRuntimeWork)
            {
                MasterLocationFormats = DisabledFormats,
                ViewLocationFormats = DisabledFormats,
                PartialViewLocationFormats = partialViewLocationFormats,
                AreaMasterLocationFormats = DisabledFormats,
                AreaViewLocationFormats = DisabledFormats,
                AreaPartialViewLocationFormats = areaPartialViewLocationFormats,
                ViewLocationCache = new ThemeViewLocationCache(parameters.VirtualPath),
            };

            return viewEngine;
        }
        public IViewEngine CreateModulesViewEngine(CreateModulesViewEngineParams parameters)
        {
            var areaFormats = new[]
            {
                "~/Core/{2}/Views/{1}/{0}.php",
                "~/Modules/{2}/Views/{1}/{0}.php",
                "~/Themes/{2}/Views/{1}/{0}.php",
            };

            var universalFormats = parameters.VirtualPaths
                .SelectMany(
                    x => new[]
                        {
                            x + "/Views/{0}.php",
                        })
                .ToArray();

            var viewEngine = new PhpViewEngine(_phpRuntimeWork)
            {
                MasterLocationFormats = DisabledFormats,
                ViewLocationFormats = universalFormats,
                PartialViewLocationFormats = universalFormats,
                AreaMasterLocationFormats = DisabledFormats,
                AreaViewLocationFormats = areaFormats,
                AreaPartialViewLocationFormats = areaFormats,
            };

            return viewEngine;
        }