Filter by category on the home page

Topics: Enhanced Blog Edition
Mar 20, 2008 at 5:48 AM
I have the EBE installed and I love it. One thing I can't figure out how to do is filter by a certain category on the home page. I want to reserve one category just for generalized posts and display that on the home page, and leave the posts in specific categories for readers to select on their own. Is there a simple way to either filter posts on the home page or prevent posts from being displayed on the home page?
Developer
Mar 20, 2008 at 9:34 AM
You would need to modify Home.aspx and either....

1. Remove the <EBE:PostList /> control and replace with a <EBE:List List="Posts" ... /> control. You could then create a special XSLT file which filters the posts based on the categories.

2. Remove the <EBE:PostList /> control and replace with a <EBE:BaseQueryControl ... /> control. I haven't tried this, but it would be something along the lines of...

<EBE:BaseQueryControl runat=server
         ViewFieldsXML = "<FieldRef Name='Title'/><FieldRef Name='ID'/><FieldRef Name='Author'/><FieldRef Name='Body'/><FieldRef Name='NumComments'/><FieldRef Name='PublishedDate'/><FieldRef Name='PostCategory' Nullable='True'/><FieldRef Name='FileDirRef'/><FieldRef Name='BlogTitleForUrl'/><FieldRef Name='CategoriesAsText' Nullable='True' /><FieldRef Name='NumLinkbacks' Nullable='TRUE'/>"
         QueryXML = "<OrderBy><FieldRef Name='PublishedDate' Ascending='FALSE'/></OrderBy><Where><Eq><FieldRef Name='Categories'/><Value Type='Text'>YOUR CAT</Value></Eq></Where>"
         ListsXml = "<Lists BaseType='0'/>" WebsXml = "" Transform-XslName="your.xsl" />

This may help....http://blog.thekid.me.uk/archive/2007/02/27/spsitedataquery-samples-for-wss-v3.aspx

--Vince
Mar 20, 2008 at 9:28 PM
#2 did the trick. Thanks much.