Headline News Control

19. March 2009 1:33 PM

Sometimes I wish some of my posting always pinned at the top of my blog which can delivery to each of the new reader without wasting thier time to search through the old posting, like I would like to publish an announcement for a certain of time frame. Unfortunately I can not get a ready to use control for it. Therefore, I come to the mind to create my own headline control that serve my purpose, and after a struggle few days of coding... Finally I get my headline control up and deploy into my blogging site.

Since it is a add on feature for the BlogEngine.NET, and I would like to share with other BlogEngine.NET user as well. For time being, I have customized the NewsBar for freshcitrus and inove theme. I will try to adopt it to more themes in future for those who would like to use this control in thier blog.

To deploy this headline control into your blog site is simple, all you need to do is follow the steps below and you will get it done and running in just few minutes,

How to...

  1. Unzip the downloaded headline control
  2. Copy the following files into the respective theme folder
    1. NewsBar.ascx
    2. NewsBar.ascx.cs
    3. NewsBar.css
    4. site.master 1
  3. Copy the nbmc.png2 into the images folder under the theme folder.
  4. Refresh your blog, and login to start defined the headline news and featured news that you wish to pinned at top of your blog.

 

To do...

1To consume the headline control, all you just need to do is add the following code into the site.master file,

   1:  <%@ Register TagPrefix="hz" TagName="NewsBar" Src="NewsBar.ascx" %>
   2:  <!-- place the following code at the place you want the headline control to be shown -->
   3:  <hz:NewsBar id="newsbar" runat="server" />

2The nbmc.png is the admin control panel background image used headline control (NewsBar.ascx), you may create your own image and overwrite it or even modify the NewsBar.css to fit your selected theme.

Where is...

All the defined headline and features news was save under App_Data\NewsBar.xml with the following format.

   1:  <?xml version="1.0" encoding="utf-8" standalone="yes"?>
   2:  <News>
   3:      <Title>A1 Headline</Title>
   4:      <ShowTitle>0</ShowTitle>
   5:      <PublishLocation>1</PublishLocation>
   6:      <Headline Type="0">539c672f-f9d1-47bf-bb11-c7e698751fb8</Headline>
   7:      <Featured>
   8:          <Post Type="0">0ce20c70-779a-4031-a167-858681447648</Post>
   9:          <Post Type="0">17084e6e-4cb1-4694-8d43-5d58acc08a42</Post>
  10:      </Featured>
  11:  </News>

Where the Type="0" mean the stored GUID is refering to a Post, and Type="1" mean refering to a Page.

Admin Console...

Once you have login, the 'Headline Management Concole' as shown in screen shot below will be available for you.

 Headline Management Console

With the console, you can make the following change,

  1. Change the headline section title.
  2. Decide to show/hide the headline section title.
  3. Define where you want the headline/features news beging display
    1. None
    2. All Location
    3. Post list only
    4. Single post
    5. Single page
    6. Post list and single post
    7. Post list and single page
    8. Post list and page list
  4. Select which page/post to be display as headline news.
  5. Add/remove any page/post from the featured news list.

Update...

  • 24, March 2009 11:52 AM, Included Newsbar for PortraitPress theme.
  • 13, April 2009 12:00 PM, Limit dedicated group of user access the Newsbar's admin console, more...

 

Download Here... 

newsbar-freshcitrus.zip (9.77 kb) [Downloads: 26]
newsbar-inove.zip (11.57 kb) [Downloads: 29]
newsbar-portraitpress.zip (8.72 kb) [Downloads: 23]

BlogEngine.NET

Comments

Prima
4/10/2009 7:28:09 AM #
This is a great control. Good work. How do I make the control only visible to the Administrator role? I do not want Editors to see this control when the log in.
Thank you.
4/13/2009 12:57:24 PM #
Prima4/10/2009 7:28:09 AM #This is a great control. Good work. How do I make the control only visible to the Administrator role? I do not want Editors to see this control when the log in.
Thank you.


Hi Prima,

That is a very good question and I have made the necessary update base on your suggestion. You may download or read more it from here code.devworkspace.com/.../...e-Control-Update.aspx

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading