Step 1
Start off by creating a new directory called "Sample" in your root web directory. (referred to web/sample/ from here on out).
Now create a new text file called "Default.aspx", open up this file with notepad, and add the following lines.
<%@ Page %>
<%--
This is my placeholder, my actual file is located in web/themes/[THEME NAME]/sample/sample.aspx
--%>
Step 2 - Creating the themed page
For this article, we will only be covering how to do this on the default theme, you can pretty much apply this to all other themes.
In your web/Themes/ directory, create a new directory called "sample".
Next, create a new text file and name it "sample.master", open up this file with notepad, and add the following lines.
<%@ Master Language="C#" AutoEventWireup="true" MasterPageFile="../Common/master.Master" %>
<asp:Content ContentPlaceHolderID="HeaderRegion" runat="server" >
<CSControl:SelectedNavigation Selected="sample" runat="Server" />
<CSControl:ThemeStyle runat="server" href="~/style/forum.css" mce_href="~/style/forum.css" />
<CSControl:ThemeStyle runat="server" href="~/style/gallery.css" mce_href="~/style/gallery.css" />
<CSControl:ThemeStyle runat="server" href="~/style/forum_print.css" mce_href="~/style/forum_print.css" media="print" />
<CSControl:ThemeStyle runat="server" href="~/style/gallery_print.css" mce_href="~/style/gallery_print.css" media="print" />
</asp:Content>
<asp:Content ContentPlaceHolderID="bcr" runat="server">
<asp:ContentPlaceHolder id="bcr" runat="server" />
</asp:Content>
<asp:Content ContentPlaceHolderID="rcr" runat="server" >
<asp:ContentPlaceHolder ID="rcr" runat="server" />
</asp:Content>
Just to explain a bit, we have created a new master page that inherits the master.Master for the website, we have overridden the header region to select the "sample" page, and finally we have created two content regions for the page (CS 2007 style).
At this point, you can add any custom code to the your new pages "main" template, but for now, lets just leave it as is.
Now, lets create another text file, and call it "sample.aspx" and open it up in notepad.
The first thing we want to do in this file, is all of the standard asp.net page definitions, as well as import some common namespaces, useful for coding later on. This also keeps our "ad support".
<%@ Page EnableViewState="false" Language="C#" AutoEventWireup="true" Inherits="CommunityServer.Controls.CSThemePage" MasterPageFile="sample.Master" %>
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Register TagPrefix="CSUserControl" TagName="AdTop" src="../Common/Ad-Top.ascx" mce_src="../Common/Ad-Top.ascx" %>
<%@ Register TagPrefix="CSUserControl" TagName="AdBottom" src="../Common/Ad-Bottom.ascx" mce_src="../Common/Ad-Bottom.ascx" %>
Next, we will set the pages title, this is something that we can't remember seeing in CS 2.1, its quite useful for creating "sub" sites within your main site. For now we will set the title to the default site name.
<script language="C#" runat="server">
void Page_Load()
{
SetTitle(CurrentCSContext.SiteSettings.SiteName, false);
}
</script>
Now we will move on to adding our bcr area or, Body Content Area. This is much cleaner then the previous way of adding content parts, as you now don't have to be a html code guru and can simply enter in regular html code.
<asp:Content ID="Content1" ContentPlaceHolderID="bcr" runat="server">
<div class="CommonContentArea">
<CSControl:AdPart runat = "Server" contentname="StandardTop" ContentCssClass="CommonContentPartBorderOff" ContentHoverCssClass="CommonContentPartBorderOn">
<DefaultContentTemplate>
<CSUserControl:AdTop runat="server" />
</DefaultContentTemplate>
</CSControl:AdPart>
<div class="CommonContent">
<CSControl:ContentPart ContentName="sample" runat="server" ContentCssClass="CommonContentPartBorderOff" ContentHoverCssClass="CommonContentPartBorderOn">
<DefaultContentTemplate>
<h2 class="CommonTitle">Sample Page</h2>
<div class="CommonContent">
<div style="line-height: 140%;">
You have created a sample page!
</div>
</div>
</DefaultContentTemplate>
</CSControl:ContentPart>
</div>
<CSControl:AdPart runat="Server" ContentName="StandardBottom" ContentCssClass="CommonContentPartBorderOff" ContentHoverCssClass="CommonContentPartBorderOn">
<DefaultContentTemplate>
<CSUserControl:AdBottom runat="server" />
</DefaultContentTemplate>
</CSControl:AdPart>
</div>
</asp:Content>
Finally, lets add our rcr area or, Right Content Area.
<asp:Content ContentPlaceHolderID="rcr" runat="server">
<div class="CommonSidebar">
<CSControl:ContentPart ContentName="sampleSidebar1" runat="server" ContentCssClass="CommonContentPartBorderOff" ContentHoverCssClass="CommonContentPartBorderOn">
<DefaultContentTemplate>
<div class="CommonSidebarArea">
<div class="CommonSidebarRoundTop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div>
<div class="CommonSidebarInnerArea">
<h4 class="CommonSidebarHeader">Sidebar 1</h4>
<div class="CommonSidebarContent">
<p>
Sign-in with your Admin account and double-click to edit me!
</p>
</div>
</div>
<div class="CommonSidebarRoundBottom"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div>
</div>
</DefaultContentTemplate>
</CSControl:ContentPart>
</div>
</asp:Content>
Adding the page to the SiteUrls
Unlike CS 2.1, you must complete this next step for a page to even load in the web application.
Open up the "SiteUrls.config" file with notepad.
Scroll down to around line 562. You will see a comment that says "When adding custom locations, add above here." We are going to do just that.
Add the following just above the comment.
<location name="sample" path="/sample/" themeDir="sample">
<url name="samplehome" path="" pattern="default.aspx" vanity="{2}" physicalPath="##themeDir##" page="sample.aspx" />
</location>
Now, before you go jumping off to your newly created page, we have a few more things to do, or else you are going to get some errors.
Adding the link to the top menu
With the SiteUrls.config file still open, scroll down the bottom to the "navigation" section. Just under the "home" link, add the following.
<link name="sample" resourceUrl="samplehome" resourceName="sample" roles="Everyone" />
Save the file, and go ahead and close the SiteUrls.config.
As you noticed in my previous articles, until you add the resource to the resources.xml, your link will not show up on the main link menu.
Navigate to "web/languages/[YOUR LANGUAGE]/" and open up the file "Resources.xml" with notepad.
Around line 44, you will see the text "<!-- Main Navigation -->" just below the "Home" resource, add the following code.
<resource name="sample">Sample</resource>
Save the file.
Restarting the web application
At this point we need to just "touch" the web.config file, this is done by opening the file with notepad, saving, then closing the file.
Navigate to your newly created page
Finally, you should be able to goto your home page, click on the sample link, and see your new page!
If you don't see it, start back at the beginning and find out what you did wrong. Or post up in my forums for help and We will try to help you out.
Contact us at http://www.asphostportal.com.
Reasons why you must trust ASPHostPortal.com
Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they're really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.
You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:
- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization - as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal's top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients' critical sites and services.