Text at the end of a post

Topics: ASP.NET 2.0
Sep 16, 2009 at 9:08 PM

I would like to have some text after someone clicked on [more].

I cant put it in the postview because it's will always be displayed. I only want it to be visible when someone clicked to see full post.

Is there a way to do this?? and how?

 

Thank you for helping me!

Coordinator
Sep 17, 2009 at 8:08 AM

You can still add the text in PostView.  PostView, which inherits from PostViewBase, exposes a property named 'Location' that lets you know if the post is being served as a full post (by itself), or if it's being served in a list (like the homepage), in an RSS feed, etc.  Here's an example of code you could add in PostView that would display text only when the full post is being shown.

<%
    if (Location == BlogEngine.Core.ServingLocation.SinglePost)
    {
%>
        this text is only shown when the full post is displayed.
<%
    }
%>

Sep 17, 2009 at 8:53 AM

that's what i wanted to hear!!! thank you very mutch.

1 more question, is it hard to script that this only will be displayed in the post from admin 'cornelis' ? So if another admin posts it shouldnt be visible..

Coordinator
Sep 17, 2009 at 9:35 AM

You can access the Post, including properties like Author from PostView as well ...

<%
    if (Location == BlogEngine.Core.ServingLocation.SinglePost &&
        Post.Author.Equals("cornelis", StringComparison.OrdinalIgnoreCase))
    {
%>
        this text is only shown when the full post is displayed.
<%
    }
%>

Sep 17, 2009 at 10:03 AM

thank you very mutch!

Can i pay with iDeal? ;)