Blogs "Most Viewed" etc.

  • Need a little help with code if somebody has a moment: 
    I'm trying to replicate the blogs' "most comments" and "most views" sidebar content parts on my main page and haven't been able to find one block of code to paste into my default.aspx to get the content and styling.  Does anyone know where I can find this?  Thanks! 

    Here's what I've got so far (thanks to Ben Tiedt for everything except the botched styling efforts which I take full responsibility for and you can view here:
    <div class="CommonSidebar">
    <
    div class="CommonSidebarArea">
    <
    div class="CommonSidebarContent">
    <
    Blog:AggregatePostList PageSize="3" SortBy="MostComments" runat="Server" id="Aggregatepostlist2">
    <
    SkinTemplate>
    <Blog:AggregateList TitleTextLength=22 EnablePager=false id="Posts" runat="Server">
    <SkinTemplate>
    <asp:Repeater id="Posts" runat="Server" >
    <ItemTemplate>
    <div>
    <h5><asp:HyperLink Runat="server" id="TitleLink" /></h5>
    <div><asp:HyperLink runat="server" id="User" /></div>
    <div><asp:Literal runat="server" id="Posted" /></div>
    </div>
    </ItemTemplate>
    </asp:Repeater>
    <CS:Pager runat="Server" id="PostsPager" Visible = "false" />
    </SkinTemplate>
    </Blog:AggregateList>
    </
    SkinTemplate>
    </
    Blog:AggregatePostList>
    </
    div>
    </
    div>
    </
    div>

    Thanks, Patrick
  • try this code:
    <Blog:AggregatePostList PageSize="3" SortBy="MostComments" runat="Server" id="Aggregatepostlist2">
      <SkinTemplate>
        <Blog:AggregateList TitleTextLength=22 EnablePager=false id="Posts" runat="Server">
          <SkinTemplate>
            <asp:Repeater id="Posts" runat="Server" >
              <HeaderTemplate>
              <div class="CommonSidebarArea">
                <h4 class="CommonSidebarHeader">Most Comments</h4>
                  <div class="CommonSidebarContent">
              </HeaderTemplate>
              <ItemTemplate>
                <div class="CommonSidebarContentItem">
                  <h5><asp:HyperLink Runat="server" id="TitleLink" /></h5>
                  <asp:HyperLink runat="server" id="User" /><br />
                  <asp:Literal runat="server" id="Posted" />
                </div>
              </ItemTemplate>
              <FooterTemplate>
                <CS:Pager runat="Server" id="PostsPager" Visible = "false" />
                </div>
                </div>
              </FooterTemplate>
            </asp:Repeater>
          </SkinTemplate>
        </Blog:AggregateList>
      </SkinTemplate>
    </Blog:AggregatePostList>

    You will also want to add the following CSS code to your common.css file:


    .CommonSidebarContentItem h5{
          margin:0;
          }

    I think this should work - let me know how it turns out

  • Works great, all I need to do is get the text size a little smaller to match the blogs page and so that it doesn't wrap under.  Think you could point me in the right direction?  Thanks for your help!  This might be a good tutorial for your tips blog, what do you think? 

    Thanks, Patrick
  • Hi Patrick

    Can you point me to a page that has your control on it? It seems to work fine on my test servers, so I don;t understand what you mean by wrap under.

  • Thanks again for your help, I just needed the text a bit smaller.  Here's the code I'm using at www.buyspace.com - This exactly replicates the content on the blogs page.  The only problem I have now is that the control automatically sets the browser title to include "Blogs" which is OK but I'd like to remove it eventually and add "Home".  Any pointers for a new community?  Cheers!

    <Blog:AggregatePostList PageSize="3" SortBy="MostComments" runat="Server" id="Aggregatepostlist2">
    <
    SkinTemplate>
    <Blog:AggregateList TitleTextLength=22 EnablePager=false id="Posts" runat="Server">
    <SkinTemplate>
    <asp:Repeater id="Posts" runat="Server" >
    <HeaderTemplate>
    <div class="CommonSidebarArea">
    <h4 class="CommonSidebarHeader">Add Title Here</h4>
    <div class="CommonSidebarContent">
    <ul class="CommonSidebarList">
    </HeaderTemplate>
    <ItemTemplate>
    <li>
    <asp:HyperLink Runat="server" id="TitleLink" />
    </li>
    </ItemTemplate>
    <FooterTemplate>
    </ul>
    </div>
    </div>
    </FooterTemplate>
    </asp:Repeater>
    </SkinTemplate>
    </Blog:AggregateList>
    </
    SkinTemplate>

    Thanks, Patrick
  • Hi Patrick

    There is an attribute called EnableTitle that I would think would turn off that feature, but it does not seem to work. I have to confess that I have no idea how to prevent "blogs" from appearing in the site title.