Hi, I give up Having failed to get the subjectline of post with PostID 8 outputed on the frontpage:
Attempt 1:
<CSControl:PostData Text="|{0}|" Property="Body" runat="server"> <DisplayConditions> <CSControl:PostPropertyValueComparison ComparisonProperty="PostID" ComparisonValue="8" Operator="EqualTo" runat="server" /> </DisplayConditions> </CSControl:PostData>
Attempt 2:
<CSControl:PostData DataSource="<%# WeblogPosts.GetPost(8, false, true,true) %>" Text="Subject:{0}" Property="Subject" runat="server"> </CSControl:PostData>Attempt 3:
<CSBlog:WeblogPostData DataSource="<%# WeblogPosts.GetPost(8, false, true,true) %>" runat="server"> <ContentTemplate> <%# Eval("Subject") %> </ContentTemplate> </CSBlog:WeblogPostData>
I also thought of using a PostList but.. will wait for your reply now Thanks,Anders
Lunarmedia.com
This is a somewhat unusual case (using a specific ID), but you can use an application-specific post list, such as:
<CSBlog:WeblogPostList runat="server"> <QueryOverrides PostID="499227" /> <ItemTemplate> <CSBlog:WeblogPostData Property="Subject" runat="server" /> </ItemTemplate></CSBlog:WeblogPostList>
I found a solution. We wanted to retrieve a blogpage/article. This is how you do it:
<CSBlog:WeblogPostList runat="server"> <QueryOverrides PostID="6" BlogPostType="Article" PostConfig="Empty" /> <ItemTemplate> <CSBlog:WeblogPostData Property="Subject" Tag="h2" runat="server" /> </ItemTemplate> </CSBlog:WeblogPostList>
The tricky part was setting PostConfig to the correct value With this solution we dont need to set the defaultApplicationKey value in cs.config.This is amazing stuff - great work on the Chameleon guys!Anders
Excellent. Glad you're enjoying Chameleon.
Most of the CS API is exposed via Chameleon controls.
Correct. TruncateAt will remove all formatting before truncating the post.
You can not safely truncate a post written in HTML without first removing the HTML. Otherwise you run the risk of generating invalid markup and making the page unusable.
HTH,Scott
Follow Me On Twitter
Anders V.:A related question to the WeblogPostList: I am outputting the Body text of the articlepost. However, all formatting is removed. Even if I use FormattedBody:<CSBlog:WeblogPostData Property="FormattedBody" TruncateAt="120" TruncationEllipsisText="..." runat="server" />Using Eval("Body") keeps formatting but then we lose the neat TruncateAt feature.
Using TruncateAt will cause the HTML to be stripped -- this results in a HTML-safe truncated version of the page (without unclosed tags or improperly early-closed tags). Accessing just Property="Body" or Property="FormattedBody" (without specifying a value for TruncateAt) will include all formatting.
Note, too, that you should not render Eval("Body") -- this property contains the original, unprocessed text before CSModules (censorship, html scrubbing, etc) have been executed. Accessing the Body or FormattedBody properties of the WeblogPostData control will ensure that you are rendering the content with all CSModules executed.
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com