Adding Front Page News to CS 2.1

written by Rick Reszler on Thursday, April 19 2007

If you recently upgraded to Community Server 2.1 from 2.0 and would like to have the recent blogs posts and whos online back on the home page like it use to be then all you need to do is add the code in red below to your default.aspx file which can be found in the root folder of your Community Server site.

 

<%@ Page SmartNavigation="False" Language="C#"  enableViewState = "false" %>
<%@ Register TagPrefix="CSD" Namespace="CommunityServer.Discussions.Controls" Assembly="CommunityServer.Discussions" %>
<%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>
<%@ Register TagPrefix="Galleries" Namespace="CommunityServer.Galleries.Controls" Assembly="CommunityServer.Galleries" %>
<%@ Register TagPrefix="Blog" Namespace="CommunityServer.Blogs.Controls" Assembly="CommunityServer.Blogs" %>
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="CommunityServer.Discussions.Components" %>
<%@ Import Namespace="CommunityServer.Blogs.Components" %>
<%@ Import Namespace="CommunityServer.Galleries.Components" %>

<script language="C#" runat="server">
void Page_Load(object sender, EventArgs e)
{
    UsersOnline.SetLocation("Home");
    MyForums.Visible = ApplicationSet.Applications[ApplicationType.Forum].Enabled;
    ActivePosts.Visible = ApplicationSet.Applications[ApplicationType.Forum].Enabled;
    UnansweredPosts.Visible = ApplicationSet.Applications[ApplicationType.Forum].Enabled;
    AggregateGalleryPosts.Visible = ApplicationSet.Applications[ApplicationType.Gallery].Enabled;   
}
</script>

<CS:MPContainer runat="server" id="Mpcontainer1" ThemeMasterFile = "HomeMaster.ascx" >

    <CS:MPContent id="bcr" runat="server">
        <div class="CommonContentArea">
            <div class="CommonContent">
           
                <CS:AdPart runat = "Server" contentname="StandardTop" >
                    <CS:Ads Zone="StandardTop" runat="server" id="Ads1" />
                </CS:AdPart>
           
                <CS:ContentPart runat = "Server" contentname="welcome" id = "welcomeContentPart" text="&lt;p&gt;&lt;IMG src=&quot;utility/images/cs-home-1.gif&quot;&gt;&lt;br /&gt;&lt;div style=&quot;padding-left:75px;&quot;&gt;&lt;p&gt;&lt;a href=&quot;http://communityserver.org/r.ashx?3&quot; target=&quot;_blank&quot;&gt;Community Server&lt;/a&gt; is the award winning platform for quickly and easily creating online communities and has all the integrated tools, such as: discussion forums, blogs, photo galleries, file galleries, search, RSS tools, content management, advanced user permissions required for building communities.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://communityserver.org/r.ashx?3&quot; target=&quot;_blank&quot;&gt;Community Server&lt;/a&gt; also supports a number of add-ons and gateways that enable additional functionality such as: single sign-on modules, posting to your blog through email, the ability to post and reply to forums through email, and file management tools for easy drag-and-drop management of your file or photo gallery. You can learn more about these add-ons and others at &lt;a href=&quot;http://communityserver.org/r.ashx?3&quot; target=&quot;_blank&quot;&gt;communityserver.org&lt;/a&gt;.&lt;/p&gt; &lt;IMG src=&quot;utility/images/showcase.gif&quot;&gt;&lt;br /&gt;&lt;a title=&quot;MSNBC Cosmic Log&quot; href=&quot;http://cosmiclog.msnbc.msn.com&quot;&gt;&lt;IMG border=0 src=&quot;utility/images/showcase-4.gif&quot;&gt;&lt;/a&gt;  &nbsp; &lt;a title=&quot;Mix06 Conference&quot; href=&quot;http://mix06.com&quot;&gt;&lt;IMG border=&quot;0&quot; src=&quot;utility/images/showcase-1.gif&quot;&gt;&lt;/a&gt; &nbsp; &lt;a title=&quot;Hive.NET&quot; href=&quot;http://hive.net&quot;&gt;&lt;IMG border=&quot;0&quot; src=&quot;utility/images/showcase-2.gif&quot;&gt;&lt;/a&gt; &nbsp; &lt;a title=&quot;Gearlog.com&quot; href=&quot;http://gearlog.com&quot;&gt;&lt;IMG border=&quot;0&quot; src=&quot;utility/images/showcase-3.gif&quot;&gt;&lt;/a&gt;  &nbsp; &lt;a title=&quot;Major Nelson&quot; href=&quot;http://majornelson.com&quot;&gt;&lt;IMG border=&quot;0&quot; src=&quot;utility/images/showcase-5.gif&quot;&gt;&lt;/a&gt;  &nbsp; &lt;IMG src=&quot;utility/images/awards.gif&quot;&gt;&lt;p&gt;&lt;IMG src=&quot;utility/images/telligent.gif&quot;&gt;&lt;br /&gt;&lt;a href=&quot;http://communityserver.org/r.ashx?2&quot; target=&quot;_blank&quot;&gt;Telligent&lt;/a&gt;, the company who builds, maintains, supports, and licenses the Community Server platform, is a full service Microsoft .NET solutions company.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;IMG src=&quot;utility/images/cs-home-2.gif&quot;&gt;&lt;div style=&quot;padding-left:75px;&quot;&gt;&lt;a href=&quot;http://communityserver.org/r.ashx?3&quot;&gt;&lt;b&gt;CommunityServer.org&lt;/b&gt;&lt;/a&gt; - The community for Community Server. The best place to start!&lt;br /&gt;&lt;a href=&quot;http://communityserver.org/files/folders/513585/download.aspx&quot;&gt;&lt;b&gt;Licensing &amp; Add-ons&lt;/b&gt;&lt;/a&gt; - Details on licensing and additional features for your Community Server system.&lt;br /&gt;&lt;a href=&quot;http://docs.communityserver.org&quot;&gt;&lt;b&gt;User documentation&lt;/b&gt;&lt;/a&gt; - Includes how-tos and explanations for Community Server features.&lt;br /&gt;&lt;a href=&quot;http://communityserver.org/blogs/videos/default.aspx&quot;&gt;&lt;b&gt;How to Videos&lt;/b&gt;&lt;/a&gt; - Watch an ever growing list of videos about Community Server.&lt;br /&gt;&lt;a href=&quot;http://telligent.com/contact/&quot;&gt;&lt;b&gt;Support, development, and hosting&lt;/b&gt;&lt;/a&gt; - Contact Telligent for support, as well as hosting and custom development recommendations.&lt;p&gt;Other useful resources:&lt;br /&gt;&lt;a href=&quot;http://communityserver.org/blogs/announcements/default.aspx&quot;&gt;&lt;b&gt;Community Server Announcements Blog&lt;/b&gt;&lt;/a&gt; - Subscribe and keep up-to-date with the latest announcements.&lt;br /&gt;&lt;a href=&quot;http://communityserver.org/blogs/dailynews/default.aspx&quot;&gt;&lt;b&gt;Community Server Daily News Blog&lt;/b&gt;&lt;/a&gt; - Subscribe and get daily updates about Community Server.&lt;br /&gt;&lt;a href=&quot;http://developer.communityserver.org&quot;&gt;&lt;b&gt;Software Developer Wiki&lt;/b&gt;&lt;/a&gt; - Basic developer documentation.&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;/p&gt;' />
            </div>
           
            <div class="CommonContent">

                <Blog:AggregatePostList runat="Server" PageSize=5 id="AggregateBlogPosts" EnablePaging="false" EnableTitle="false">
                    <SkinTemplate>
                        <h2 class="CommonTitle">
                            <asp:Literal runat="server" id="title" />
                        </h2>
                        <Blog:AggregateList id="Posts" runat="Server" EnableTitle="false"/>
                    </SkinTemplate>
                </Blog:AggregatePostList>
                <CS:WhoIsOnline runat="server" id="Whoisonline1"/>

               
            <CS:AdPart runat = "Server" contentname="StandardBottom" ID="Adpart2">
                <CS:Ads Zone="StandardBottom" runat="server" id="Ads3" />
            </CS:AdPart>
               
            </div>
        </div>
        </CS:MPContent>
       
        <CS:MPContent id="rcr" runat="server" >
            <div class="CommonSidebar">
            <CS:ContentPart runat = "Server" contentname="featured" id = "featuredContentPart" text="&lt;div class=&quot;CommonSidebarArea&quot;&gt;&lt;h4 class=&quot;CommonSidebarHeader&quot;&gt;Featured Item&lt;/h4&gt;&lt;div class=&quot;CommonSidebarContent&quot;&gt;Content Management is easy in Community Server! &lt;p&gt;Sign-in with your Admin account and double-click to edit me!&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;" />

            <CSD:ThreadRepeater runat="server" ThreadViewMode="MyForums" id="MyForums">
                        <HeaderTemplate>
                        <div class="CommonSidebarArea">
                            <h4 class="CommonSidebarHeader"><CSD:ForumAnchor class="lnk3" AnchorType="MenuMyForums" runat="server" ShowIcon = "false" ID="Forumanchor3"/></h4>
                            <div class="CommonSidebarContent">
                        </HeaderTemplate>
                        <ItemTemplate>
                                <div class="CommonSidebarContentItem">
                                    <a title="<%# ( ForumConfiguration.Instance().EnablePostPreviewPopup && CSContext.Current.User.Profile.EnablePostPreviewPopup  ? Formatter.CheckStringLength(Formatter.StripAllTags(DataBinder.Eval(Container.DataItem, "Body").ToString()), 300) : String.Empty )%>"
                                            href="<%# Globals.GetSiteUrls().Post( (int) DataBinder.Eval(Container.DataItem, "PostID") ) %> ">
                                            <%# Formatter.CheckStringLength(DataBinder.Eval(Container.DataItem, "Subject").ToString(), 22) %>
                                        </a>
                                </div>
                        </ItemTemplate>
                        <FooterTemplate>
                            </div>
                        </div>
                        </FooterTemplate>
            </CSD:ThreadRepeater>

            <CSD:ThreadRepeater runat="server" ThreadViewMode="Active" id="ActivePosts">
                        <HeaderTemplate>
                        <div class="CommonSidebarArea">
                            <h4 class="CommonSidebarHeader"><CSD:ForumAnchor class="lnk3" AnchorType="PostsActive" runat="server" id="Forumanchor1" /></h4>
                            <div class="CommonSidebarContent">
                        </HeaderTemplate>
                        <ItemTemplate>
                                <div class="CommonSidebarContentItem">
                                    <a title="<%# ( ForumConfiguration.Instance().EnablePostPreviewPopup && CSContext.Current.User.Profile.EnablePostPreviewPopup  ? Formatter.CheckStringLength(Formatter.StripAllTags(DataBinder.Eval(Container.DataItem, "Body").ToString()), 300) : String.Empty )%>"
                                            href="<%# Globals.GetSiteUrls().Post( (int) DataBinder.Eval(Container.DataItem, "PostID") ) %> ">
                                            <%# Formatter.CheckStringLength(DataBinder.Eval(Container.DataItem, "Subject").ToString(), 22) %>
                                        </a>
                                </div>
                        </ItemTemplate>               
                        <FooterTemplate>
                            </div>
                        </div>
                        </FooterTemplate>
            </CSD:ThreadRepeater>

            <CSD:ThreadRepeater ThreadViewMode="Unanswered" runat="server" id="UnansweredPosts">
                        <HeaderTemplate>
                        <div class="CommonSidebarArea">
                            <h4 class="CommonSidebarHeader"><CSD:ForumAnchor class="lnk3" AnchorType="PostsUnanswered" runat="server" id="Forumanchor2" /></h4>
                            <div class="CommonSidebarContent">
                        </HeaderTemplate>
                        <ItemTemplate>
                            <div class="CommonSidebarContentItem">
                                <a title="<%# ( ForumConfiguration.Instance().EnablePostPreviewPopup && CSContext.Current.User.Profile.EnablePostPreviewPopup  ? Formatter.CheckStringLength(Formatter.StripAllTags(DataBinder.Eval(Container.DataItem, "Body").ToString()), 300) : String.Empty )%>"
                                        href="<%# Globals.GetSiteUrls().Post( (int) DataBinder.Eval(Container.DataItem, "PostID") ) %> ">
                                        <%# Formatter.CheckStringLength(DataBinder.Eval(Container.DataItem, "Subject").ToString(), 22) %>
                                    </a>
                            </div>
                        </ItemTemplate>               
                        <FooterTemplate>
                            </div>
                        </div>
                        </FooterTemplate>
            </CSD:ThreadRepeater>

                    <Galleries:AggregatePortalPictureListing EnableTitle="false" Count="5" SortBy="ThreadDate" runat="server" ID="AggregateGalleryPosts"/>

            </div>
        </CS:MPContent>
       
</CS:MPContainer>

 

Similar Posts

  1. Display Specific Blog or Blog Group Posts
  2. Community Server 2.1 SP1 Released!
  3. Community Server 2.1, Service Pack 2 Released

Comments are closed

Options:

Size

Colors