Example #1
0
        public Template getTemplateByPath( IViewsPath viewsPath )
        {
            List<String> dirList = MvcConfig.Instance.ViewDirList;
            if (dirList.Count == 0) {
                return new Template( viewsPath.getPath( MvcConfig.Instance.ViewDir ) );
            }

            StringBuilder notFoundPath = new StringBuilder();
            foreach (String dir in dirList) {

                MvcContext ctx = _controller == null ? null : _controller.ctx;

                if (isSkipDir( ctx, dir )) continue;

                String xPath = viewsPath.getPath( dir );
                if (Template.ContainsCache( xPath )) return new Template( xPath );

                Template x = new Template( xPath );
                if (x.IsTemplateExist()) return x;

                notFoundPath.Append( xPath );
                notFoundPath.Append( "<br/>" );
            }

            Template ret = new Template();
            ret.NoTemplates( notFoundPath.ToString() );
            return ret;
        }
Example #2
0
        public Template getTemplateByPath(IViewsPath viewsPath)
        {
            List <String> dirList = MvcConfig.Instance.ViewDirList;

            if (dirList.Count == 0)
            {
                return(new Template(viewsPath.getPath(MvcConfig.Instance.ViewDir)));
            }

            StringBuilder notFoundPath = new StringBuilder();

            foreach (String dir in dirList)
            {
                MvcContext ctx = _controller == null ? null : _controller.ctx;

                if (isSkipDir(ctx, dir))
                {
                    continue;
                }

                String xPath = viewsPath.getPath(dir);
                if (Template.ContainsCache(xPath))
                {
                    return(new Template(xPath));
                }

                Template x = new Template(xPath);
                if (x.IsTemplateExist())
                {
                    return(x);
                }

                notFoundPath.Append(xPath);
                notFoundPath.Append("<br/>");
            }

            Template ret = new Template();

            ret.NoTemplates(notFoundPath.ToString());
            return(ret);
        }