Best way to add a "landing page" - not part of the layout.master

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/2/2011 3:22:13 PM
Gravatar
Total Posts 21

Best way to add a "landing page" - not part of the layout.master

I'm trying to add a landing page that doesn't use the layout.master (no header, no navigation) and I'm wondering what the best approach is.

If I understand correctly, dropping an .aspx page (and corresponding .cs and designer page) somewhere in the site root isn't the best option... or is that OK?

We don't really care if it's indexed for the site search feature. Any help is appreciated.

11/2/2011 3:55:25 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Best way to add a "landing page" - not part of the layout.master

If you want a completely independent look for the site home page, you can turn on "Allow Setting Skin for Page" in Administration, Site Settings. Then you could create a custom skin (with layout.master) and use that only on the home page. In that skin's layout.master, leave out the header, menu navigation, topnav, etc. The only down side would be that it's the site home page, so selecting "home" or clicking the site logo from another page would take you back to it.

11/3/2011 7:52:33 AM
Gravatar
Total Posts 18439

Re: Best way to add a "landing page" - not part of the layout.master

Hi,

For the scenario you describe where it isn't a CMS page and doesn't need to visually integrate I see no reason for it to be a bad idea to drop in a page of your own making, it doesn't have to use our skinning model at all if you don't want it to and it doesn't have to inherit from mojoBasePage.

My only advice is if you are using code behind and .designer.cs files you should implement that in a different project and use a post build event to copy the .aspx page and the dll up to mojoPortal web project. I don't recommend adding your ownn files to the mojoPortal project and compiling them in with mojoPortal.

An easier way would be to use inline code instead of using codebehind files, that way you can just drop it in, it doesn't have to be part of the project. The following example is just a plain old .aspx page implemented with inline code in a single text file, ie you could copy it into a text file with a .aspx extension and modify it and drop it in. It doesn't use our skinning model and doesn't inherit from mojoBasePage.

<%@ Page Language="C#" ClassName="MyCustomPage.aspx" Inherits="System.Web.UI.Page"   %>
<%@ Import Namespace="mojoPortal.Business" %>
<%@ Import Namespace="mojoPortal.Business.WebHelpers" %>
<%@ Import Namespace="mojoPortal.Web" %>
<%@ Import Namespace="mojoPortal.Web.Framework" %>
<%@ Import Namespace="mojoPortal.Web.Controls" %>
<%@ Import Namespace="mojoPortal.Web.UI" %>
<%@ Import Namespace="mojoPortal.Web.Editor" %>
<%@ Import Namespace="mojoPortal.Net" %>

<script runat="server">

    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);
    }

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
     
        LoadSettings();
        PopulateLabels();
        PopulateControls();
  Title = "Custom Page";
       
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "Hello Web";
    }

private void PopulateControls()
    {
  TextBox1.Text = "Click the button";

    }


    private void PopulateLabels()
    {
  heading.Text = "My Heading";
    }

    private void LoadSettings()
    {


    }

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>MyClass</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Your custom form goes here.
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</div>
</form>
</body>
</html>

you don't need all the import stuff at the top unless you want to access mojoPortal code from your code.

We also have a Codesmith template included in the source code that can generate an inline page either with or without inheriting from mojoBasePage. The above was generated by that template.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.