Example #1
0
        public string RenderPage(RequestContext request)
        {
            if (File.Exists(Template))
            {
                string page = ApplyTemplate(request, File.ReadAllText(Template));
                //Global tags
                //Do page parts first.
                Scripting.ApplyTag("section:Header", File.ReadAllText("Data/templates/section.header.html"), ref page);
                Scripting.ApplyTag("section:Footer", File.ReadAllText("Data/templates/section.footer.html"), ref page);
                //Then persistance objects.
                foreach (var v in Persistance.API)
                {
                    Scripting.ApplyTag("persistance:" + v.Key, v.Value.ToString(), ref page);
                }
                //User tags.
                Scripting.ApplyTag("user:Id", UserSession.CurrentSession.UserId.ToString(), ref page);
                Scripting.ApplyTag("user:Name", UserSession.CurrentSession.Username, ref page);
                Scripting.ApplyTag("session:Id", UserSession.CurrentSession.SessionId.ToString(), ref page);
                //Then the nav.
                Scripting.ApplyTag("nav", ApplyNav(), ref page);
                //End

                return(page);
            }
            else
            {
                return(Render());
            }
        }