MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Is it possible to display "About me" information along with the author image in Blog details page ?  (Mono Support )

Viewed 9393 time(s), 8 post(s) 9/5/2012 2:18:54 PMby super
super

super

9/5/2012 2:18:54 PM
Is it possible to display "About me" information along with the author image in Blog details page ?

If yes, Please explain how can i achieve this ?
This content has not been rated yet. 
6018 Reputation 709 Total posts
mzilic

mzilic

9/5/2012 7:22:43 PM
Hello,

I'm assuming you mean the BlogPostView? The approach which I recommend requires some custom coding.
1. You need to edit the BlogPost.ascx template to add your own custom tag, for example:
<# AboutMe #>
2. In your custom project you need to inherit the BlogPostView control and override its ParseBlogPostTemplateTags method. This is where you should insert your custom logic, you should fetch the UserProfileEntity and add the AboutMe section in the Hashtable, for example:
var tags = base.ParseBlogPostTemplateTags(post, maxTitleChars, maxDescriptionChars, dateFormatString);
tags.Add("<# AboutMe #>", profile.AboutMySelf);
3. Inherit the BlogContainer control and copy the default markup. Change the path of the BlogPostView to point towards your custom control.
4. Inherit Blog.aspx and copy the default markup. Change the path of the BlogContainer to point towards your custom control.
5. Change web.config URL rewriting rules to point towards your custom Blog page.

Regards,
Mario
This content has not been rated yet. 
2218 Reputation 300 Total posts
super

super

1/14/2013 9:34:47 PM
Mario,

Since I don't have any .cs file (as monox is prebuild) - How am I supposed to do this ?

Also I am not able to understand how to go about it from step 2 onwards - could you please give me detailed steps PLEASE ? what to do and where to do ?
This content has not been rated yet. 
6018 Reputation 709 Total posts
mzilic

mzilic

1/14/2013 9:55:25 PM
Hello,

The process described here is intended for people without the source code. Can you be more specific as to what exactly is unclear to you?

Regards
This content has not been rated yet. 
2218 Reputation 300 Total posts
super

super

1/14/2013 11:12:24 PM
2. In your custom project you need to inherit the BlogPostView control and override its ParseBlogPostTemplateTags method. This is where you should insert your custom logic, you should fetch the UserProfileEntity and add the AboutMe section in the Hashtable, for example:
var tags = base.ParseBlogPostTemplateTags(post, maxTitleChars, maxDescriptionChars, dateFormatString);
tags.Add("<# AboutMe #>", profile.AboutMySelf);

Request: I don't have any logic requirement - All I need is that when user clicks any blog post and in the blog post content page, at the bottom of the blog post, it should display "About me" info about the author of the blog post.

I don't know where to add this code ? It can't go in ascx file...this looks like .cs code...
var tags = base.ParseBlogPostTemplateTags(post, maxTitleChars, maxDescriptionChars, dateFormatString);
tags.Add("<# AboutMe #>", profile.AboutMySelf);




3. Inherit the BlogContainer control and copy the default markup. Change the path of the BlogPostView to point towards your custom control.
Request: Could you please show me with an example ? I don't have any custome blogcontainer right now - I am trying to make changed in the original BlogContainer...


4. Inherit Blog.aspx and copy the default markup. Change the path of the BlogContainer to point towards your custom control.
Request: Since I am making changes in the original BlogContainer so I am assuming I don't need to point anything to the custom control...
What default markups you are talking about ?

5. Change web.config URL rewriting rules to point towards your custom Blog page.
Request: Where in web.config - what's the exact location ? where am I looking in config file ?
This content has not been rated yet. 
6018 Reputation 709 Total posts
khorvat

khorvat

1/15/2013 9:34:11 AM
Hi Super,

just a tip on the following:
2. In your custom project you need to inherit the BlogPostView control and override its ParseBlogPostTemplateTags method. This is where you should insert your custom logic, you should fetch the UserProfileEntity and add the AboutMe section in the Hashtable, for example:
var tags = base.ParseBlogPostTemplateTags(post, maxTitleChars, maxDescriptionChars, dateFormatString);
tags.Add("<# AboutMe #>", profile.AboutMySelf);
 
Request: I don't have any logic requirement - All I need is that when user clicks any blog post and in the blog post content page, at the bottom of the blog post, it should display "About me" info about the author of the blog post.
 
I don't know where to add this code ? It can't go in ascx file...this looks like .cs code...
var tags = base.ParseBlogPostTemplateTags(post, maxTitleChars, maxDescriptionChars, dateFormatString);
tags.Add("<# AboutMe #>", profile.AboutMySelf);
You can just put the following in your template file: "$Container.DataItem.AspnetUser.UserProfile.AboutMySelf" and use the built in support for NVelocity templating.

In this scenario I think that all this control / markup inheritance in not neccessary, Mario can you please confirm ?

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
super

super

1/15/2013 4:16:53 PM
Khorvat,

You mean in App_Templates/ Default / BlogTemplates / BlogPost.ascx

I should do like this ?

<div class="blog-item xfolkentry">
<div class="avatar">
<a href="<# AuthorProfile #>"><# Avatar #></a>
<a href="<# AuthorLink #>" class="author"><# Author #></a></span>
<div class="arrow"></div>
</div>
<div class="content <# UnpublishedClass #>">
<h2>
<span class="date"><# PubDate #></span>
<# Title #>
</h2>
<p>
<# Categories #>
<# AuthorOtherArticlesLabel #><a href="<# AuthorLink #>"><# Author #></a> <a href="<# AuthorProfile #>"><# AuthorFullName #></a>
</p>
<p><# Content #></p>
<div><# Files #></div>

<div><# $Container.DataItem.AspnetUser.UserProfile.AboutMySelf #></div>

<div class="tags"><# Tags #></div>
<div><# Rating #></div>
<div class="options clearfix">
<span class="float-left">
<# Edit #>
<# Delete #>
<# DeleteUnapproved #>
<# DeleteSpam #>
<# Publish #>
<# Email #>
<# Comments #>
</span>
<span class="float-right"><# TellAFriend #></span>
</div>
</div>
</div>
This content has not been rated yet. 
6018 Reputation 709 Total posts
khorvat

khorvat

1/17/2013 8:12:39 AM
No you just need to add it like this:

<div class="blog-item xfolkentry">
<div class="avatar">
<a href="<# AuthorProfile #>"><# Avatar #></a>
<a href="<# AuthorLink #>" class="author"><# Author #></a></span>
<div class="arrow"></div>
</div>
<div class="content <# UnpublishedClass #>">
<h2>
<span class="date"><# PubDate #></span>
<# Title #>
</h2>
<p>
<# Categories #>
<# AuthorOtherArticlesLabel #><a href="<# AuthorLink #>"><# Author #></a> <a href="<# AuthorProfile #>"><# AuthorFullName #></a>
</p>
<p><# Content #></p>
<div><# Files #></div>
 
<div>$Container.DataItem.AspnetUser.UserProfile.AboutMySelf</div>
 
<div class="tags"><# Tags #></div>
<div><# Rating #></div>
<div class="options clearfix">
<span class="float-left">
<# Edit #>
<# Delete #>
<# DeleteUnapproved #>
<# DeleteSpam #>
<# Publish #>
<# Email #>
<# Comments #>
</span>
<span class="float-right"><# TellAFriend #></span>
</div>
</div>
</div>
Without the <# & #>.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts