Add existing page to blog...

Topics: ASP.NET 2.0, Controls
Mar 27, 2009 at 10:23 PM
Hi, 
  I've some existing aspx pages.. I need to add a Blog page (and for this reason I choose BlogEngine.NET..). Is possible? I would like to add in the existing default page, the last post of Blog pages (or the last 3 posts... for example). Is it possible?

Thanks in advance

Alessandro
 
Coordinator
Mar 27, 2009 at 11:23 PM
Do you mean you have some existing ASPX pages that you want to add into BE?  Are the pages standalone pages, or are they Content pages?

BE uses masterpages.  All the physical ASPX pages within BE are Content pages ... where the content on each ASPX page is wrapped up in <asp:Content> tags.  These physical pages also inherit from the BlogBasePage class in BE.  You can see how this works by looking at the contact page, for example.  The files are contact.aspx and contact.aspx.cs.  If you were to modify your existing ASPX pages so they are Content pages and inherit from BlogBasePage, then your existing pages could pretty seamlessly fit into BE.
Mar 28, 2009 at 3:56 PM
Hi Ben!
 thanks for your answer...

No, what I mean is that I have a web site with all standalone pages. 

The stucture is very easy:
  1. Default.aspx : that should be devided into 2 part. One Fixed Text (like a presentation....) and One Dynamic part (that swould be the last 3 post of the BLOG)
  2. Contact.aspx: it's a little different (have more.. fields..)
  3. Page1.aspx: it's a fixed text page.
  4. Page2.aspx: it's a fixed text page.
  5. BLOG------> This is the Blog page that I would implement.

Thanks

Alessandro 

Coordinator
Mar 28, 2009 at 8:11 PM
The "homepage" (or frontpage) for BE is named default.aspx -- the same name as your existing default.aspx.  So if you wanted to keep your default.aspx and also use BE's default.aspx, that might require a little work to accomplish.

The easiest way to have your fixed text and the last 3 blog posts on the same page is to add your fixed text into BE's default.aspx page.  Your fixed content could be placed right above the PostList usercontrol that lists the blog posts for the frontpage:

... add your fixed content here into BE's default.aspx ...
<uc1:PostList ID="PostList1" runat="server" />  

By default, BE will show the latest 10 posts in the PostList usercontrol.  This can be changed on the Settings tab in the control panel.  The "Posts per page" is by default 10 and can be changed to 3.

You could also go the other way and add the latest 3 blog posts into your existing default.aspx page.  But this could be really involved since your existing default.aspx page would probably need to reference the BE theme's style.css file as well as some other resources.  For this case, probably changing your existing default.aspx page so it inherits from BE's BlogBasePage, and then adding the PostList usercontrol to your existing default.aspx page is going to be the easiest route.