Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int pageID = SubSonic.Utilities.Utility.GetIntParameter("id");

        if (pageID != 0)
        {
            CMS.Page p = CMS.ContentService.GetPage(pageID);
            if (p.IsLoaded)
            {
                Response.Redirect("~/view/" + p.PageUrl);
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string pageUrl = SubSonic.Utilities.Utility.GetParameter("p");

        if (pageUrl != "newpage.aspx")
        {
            //this will throw an error if the page doesn't exist
            try {
                thisPage   = CMS.ContentService.GetPage(pageUrl);
                this.Title = thisPage.Title;

                //add the keywords
                HtmlHead head = (System.Web.UI.HtmlControls.HtmlHead)Header;

                //Create a htmlMeta object
                HtmlMeta meta = new HtmlMeta();

                //Specify meta attributes
                meta.Attributes.Add("name", "keywords");
                meta.Attributes.Add("content", thisPage.Keywords);

                // Add the meta object to the htmlhead's control collection
                head.Controls.Add(meta);
            } catch {
                lnkEdit.Enabled = false;
                thisPage.Title  = "Oops! Can't find that page...";

                //you can show whichever 404 page you like. I like this one...
                string FourOFourText = SubSonic.Utilities.Utility.GetFileText(Server.MapPath("~/CMSFiles/404.htm"));
                thisPage.Body = FourOFourText;
            }
            ToggleEditor(false);
        }
        else
        {
            SetupNewPage();
            this.Title = "Create a New Page";
        }
    }