Custom Themes - Individual Post View

Topics: Controls, Themes
Aug 4, 2010 at 2:45 PM

Hey,

 

I am currently working in BlogEngine.net creating a custom theme - I have modified the PostView Control to fit the specifications of the theme, but am wondering now if there is some way to modify the View of an individual post (The page that comes up when you click on the Blog post title)  so that it's different than the layout specified in the PostView.ascx? Thanks :)

 

 

Adam Davis

Aug 4, 2010 at 3:03 PM
That would be your Post.aspx page in the root directory that you would need to edit or style.
Aug 4, 2010 at 3:19 PM

Thanks for the response, I'll toy around a bit with that file. My end goal here is to change the location of a specific <div> element that appears in the PostView.ascx when the user is viewing an individual post.

Aug 4, 2010 at 3:39 PM
Edited Aug 4, 2010 at 3:41 PM
Ok. Well your post gets loaded in the <asp:placeholder runat="server" id="pwPost" /> placeholder, so you could just enclose that in a Div and use CSS. Eg.

<div> <asp:placeholder runat="server" id="pwPost" /> </div>

#post_view #the_id_of_the_div_you_want_to_move
{
}
Aug 4, 2010 at 4:53 PM
Edited Aug 4, 2010 at 4:58 PM

:) Excellent. Thanks again - This information certainly helps illuminate the structure of the blogEngine.Net post.  Are you aware if there is any specific way to include content in the PostView.ascx in such a way that it won't be displayed in a post.aspx request?

 

http://preview.blogenginetheme.com/?theme=illacrimo

 

this theme accomplishes what I'm attempting to do here. In the main page view, the date is displayed in the left side of the screen - but when a user goes to an individual post it disappears.

Aug 4, 2010 at 5:16 PM
Edited Aug 4, 2010 at 5:19 PM
You could do it like this:
In post.aspx enclose the <asp:placeholder runat="server" id="pwPost" /> placeholder with a div, with an id "post_view":

<div id="post_view"> <asp:placeholder runat="server" id="pwPost" /> </div>

In PostView.ascx the date is inside a <span> element with a class "pubdate", so you add the following to your style.css file:

#post_view .pubDate
{ display:none;
}
Aug 4, 2010 at 7:06 PM

Hmm yeah - this is an option im considering (hiding the div w. the Display property)

 

It seems like they accomplished this in a more slick way in that theme example i linked to in the above post - the div isn't even in the HTML when you are viewing an individual post.

Aug 5, 2010 at 9:26 AM
Edited Aug 5, 2010 at 9:27 AM
You're right.

You can create a second postview control that inherits fom BlogEngine.Core.Web.Controls.PostViewBase, style it how you want and in post.aspx.cs set the path to the new control.

string path = Utils.RelativeWebRoot + "themes/" + BlogSettings.Instance.Theme + "/MyNewPostView.ascx";
Aug 5, 2010 at 3:06 PM

:) This sounds like something to try - I'll check it out soon here, thanks for the suggestion.

Aug 5, 2010 at 3:52 PM

update: This is a pretty effective solution :)

Jul 5, 2012 at 2:52 PM
B_Adams wrote:
Ok. Well your post gets loaded in the <asp:placeholder runat="server" id="pwPost" /> placeholder, so you could just enclose that in a Div and use CSS. Eg.

<div> <asp:placeholder runat="server" id="pwPost" /> </div>

#post_view #the_id_of_the_div_you_want_to_move
{
}

I think I understand what is going on here… I have a little twist to this though that I would like to ask about.

I'm pretty new to the whole blog engine, ASP.net seen… Slowly but surely picking up here and there…

 

Inside of the div mentioned above, adding the ID to it… Is it possible to insert another div ID inside, "<div> <asp:placeholder runat="server" id="pwPost" /> </div>"?

Having that inside div ID floating to the right, adding Google AdSense inside of this div ID?

 

Thank you in advance