Customizing Existing Control

Topics: Controls, Themes
May 10, 2011 at 11:56 AM

Hi,

How can I customize an existing control?

For instance I want to tweak the recent posts control:

<blog:RecentPosts ID="RecentPosts1" runat="Server" />

I want to remove the comment number and rating.  Can I do it similar to how the PostView.ascx is customized?

Many thanks

May 10, 2011 at 10:14 PM
Edited Oct 24, 2011 at 8:18 PM

Edit the widget through admin

http://www.diigo.com/item/bookmark/kbdavis07/http%3A%2F%2Fwww.kbdavis07.bloggersonline.com#image_14101074

 

Brian Davis

Java Blog

May 11, 2011 at 1:59 AM

Is there a way to edit the control itself?

The reason I ask is that the controls that come in the theme for PostView.ascx and CommentView.ascx allow for total control over how the control is displayed.  I have added image to top and bottom of posts/comments and set a class for body as well as removing some data I didn't want to show.

This has now left me with a few odd bits and bobs on the page that dont 100% match as I don't know where/how I do this.  Such as the related posts added onto bottom of post, the comment form itself and the various controls I have added to the page.

I looked inside the widget folder but couldn't see anything helpful here.  Where should I start to look to try and customize other aspects the same way as in PostView.ascx?

May 11, 2011 at 7:43 AM
Edited May 11, 2011 at 8:45 AM

The file you are looking for is this: 

RecentPost.cs

Located at  app_code/controls

 

http://blogengine.codeplex.com/SourceControl/changeset/view/e88494f7ed23#BlogEngine%2fBlogEngine.NET%2fApp_Code%2fControls%2fRecentPosts.cs

May 11, 2011 at 7:50 AM
Edited May 11, 2011 at 8:44 AM

You might can edit it through the control itself like this:



<blog:RecentPosts ID="RecentPosts1" runat="Server"
showcomments="false"
showrating="false"
/>


In theory that should work.


You can edit the control looks through css using the class="recentPosts"



Total control over how the control is displayed is done through css


Look at the page source and find all of the classes it uses to format the look through css.


Take a snapshot using this extension

Awesome Screenshot

http://awesomescreenshot.com/


With that take a screen shot and make notes on what you need done.

This will help in understanding what you need done.

Visual display is helpful :)

Also the url to the website this will help.
May 11, 2011 at 1:23 PM

Thanks Kb,

 

This is enough to get me started, I can unravel it from there :)

 

There are a few things that I can't achieve through CSS so this will help.

 

I think though that instead of modifying a control I should create my own control and just copy the code.

Jun 2, 2011 at 9:05 PM

Hello All,

Similarly I would like to modify the RecentPost widget. Can anyone point me in the right direction for this:

I would like to convert the Recent Posts widget like this - Go to http://www.huffingtonpost.com and in the sidebar is the "Most Popular on Huffpost".

To make this happen I assume several things need to be done:

1. Add a field on the add_entry.aspx - allows the user to add photo of thumbnail. Add the necessary get , set code.

2. Add a column to the table in the database, dbo.be_Posts called something like RecentPostThumbs

3. Make layout adjustments in the code to compensate for the space of the thumbnail and also drop each post text to a line which wraps to 2 lines

4. Did I miss anything?

Any help would be awesome,

HelloJonnyOh