BE Integration to Existing Site

Jun 27, 2011 at 6:22 AM

Hi all

I am moving further down the path of integrating BE into an existing site. I have a site with a master page and a full look and feel. It is a social site with other functionality, and I want to add BE for blogging. I will be doing more in the future, but iteration one is just to get it into the site cleanly. Once I get a nice integration working, what I am going to do is have a "blogroll" page that lists the site blogs with a link to a particular blog. I will also be creating some sort of "self service" function so that users can create their own blog or blogs. That is part of iteration two.

Right now I can do BE as a subdirectory, and my next step would be to do an integration with the site's existing membership. However what I would really like to do is to "fit" the blog home page into a DIV in the site's existing structure. The best way to do this would be if I could just drop all of BE into the page as a control.

So how hard would that be, to take BE and wrap is as a single control, and then to drop that control on a page? Or would there be a "better" way to do this type of integration?

Thanks

Richard

Jun 27, 2011 at 6:40 AM
Edited Oct 24, 2011 at 8:21 PM

In your code behind files replace System.Web.UI.Page  with ---> BlogEngine.Core.Web.Control.BlogBasePage

Thats it!!

Use custom web pages

If you want to create a custom web page instead of injecting user controls, you can still do that the same way as usual. Just place your custom .aspx page in the root and make it inherit from BlogEngine.Core.Web.Control.BlogBasePage instead of System.Web.UI.Page. When doing that it automatically loads your theme and master page around the page. You can then keep the look and feel of your theme, but totally control the content and functionality of your custom page.

 

http://madskristensen.net/post/User-control-injection-in-BlogEngineNET-12.aspx


Java Blog

Jun 27, 2011 at 4:44 PM

Hi kbdavis07

I tried that but I cannot seem to get it to work right. Would you mind providing a bit more of a recipe on this? The assumption would be that I have running website with a root directory, a master page setup, and many web pages in place both in the root and in other places. I want to add BE in the sub-directory where that sub-directory would have a "default.aspx" page which references the master page, and that the "default.aspx" page would show BE in a content area on that page.

For example, where would that "custom" aspx page live? Does it have to be c# or can it be vb? What do I do with the "default.aspx" page in the BE directory, leave it in place or rename it somehow? A step-by-step for dummies (like me) would be very helpful. 

Thanks

Richard

Jun 27, 2011 at 11:29 PM
Edited Jun 27, 2011 at 11:33 PM

Can you give me the url to the site?  Seeing it visually helps.

The "custom" aspx page can live any where on your server.

 

Can be C# or VB  I believe.

 

Here is what I am understanding:

 

MainSite:  www.mainsite.com    

BE site:     www.mainsite.com/blog     <--- Want it to have the same master page as the main site?

 

I want to add BE in the sub-directory

where that sub-directory would have a "default.aspx" page which references the master page,

and that the "default.aspx" page would show BE in a content area on that page.   <----This from the mainsite?

 

So www.mainsite.com/default.aspx  <--- Shows BE content?

     www.mainsite.com/blog/default.aspx <---- Same as www.mainsite.com/default.aspx

 

Does your pages on your main site have custom code or just content?

 

You can have a CMS site where you have Pages and posts at the same time like I have at my site

http://www.kbdavis07.bloggersonline.com/

 

Its integrated not just a Blog or a website with just "pages" its both.

 

Is there any reasons why you just can't install BE in the root and copy or pages into it through admin of BE?

 

Just trying to figure out what you are trying to do.

 

 

Jun 27, 2011 at 11:56 PM

Hi kbdavis07

Here is the site... www.bcgunkholing.com. You will have to create an account if you want to go in, but the homepage shows the most of it.

Thanks

Richard

Jun 28, 2011 at 1:10 AM

Best way is to convert your current theme into BlogEngine theme for the /blog   to use.

Let BE use the BE version of your master page of the root site.

 

Then in your menu just link to it "Blog"   <--- www.mainsite.com/blog

Then set up the BE theme to how ever you need it.

Jun 28, 2011 at 4:37 AM

Hi kbdavis07

That idea is certainly workable; I am not sure what is involved in doing that. What will happen when we make other changes to our master look and feel? My guess is that we would need to keep two versions of our master page. In addition there is all kinds of embedded logic and lots of custom code in some of the other page elements, and I am not sure what will happen if we convert it to a theme.

I am a realy believer in code consistency so and I like to keep a tidy directory structure. It helps with both site management and site security. So if at all possible it would be ideal if I could just fit BE into an existing page structure. It may be that I need to create a custom application. It's kind of in my long term plans anyway; I want to make BE the engine behind hosting ships logs, and those logs would have to have custom fields for latitude, longitude, weather and so on. Ultimately I would like to integrate automated updating via GPS too, but all that is well into the future.

The ideal structure would be as follows

www.mainsite.com/default.aspx (using ~/site.master) (shows site content)

www.mainsite.com/blogs/default.aspx (using ~/site.master) (shows BE content with site look and feel)

I will experiment and see what I can do. It's just that BE is such a neat ASP membership, blog hosting solution that uses SQL Server. It hits all the right buttons.

Thanks

Richard

Jun 28, 2011 at 5:48 AM

The easiest way to do it is to have

BlogEngine uses it own MasterPage aka "Theme".

Don't do anything with your current site theme aka "MasterPage".

Just make a "Theme" Masterpage from your site for BE.

 

How to make a theme:  http://rtur.net/blog/post/2010/09/05/How-to-convert-theme-to-BlogEngineNET.aspx

 

So using your current site Master Page  -----> make a theme with it for BlogEngine to use.

 

So to the user it appears that there is only "One" site  which in really its two different "Sites"  aka "Apps"

 

In the future through with all of the other things you mention it would be best to start off from scratch

with custom code for BE.

Jun 28, 2011 at 7:04 AM

I have to confess to feeling pretty stupid right now, as I cannot get the theme to work at all. I just stays with the standard theme and my "new" theme doesn't show up on the list. There must be something I am missing. Clearly I don't get it. I think it's time to go to bed. Perhaps I will try again tomorrow.

By the way, the link in the article to a "simple page" no longer works so I was not sure what to do there. I just copied the blogengine.core directive and the placeholder into my master.

Aug 5, 2011 at 9:32 PM

Thanks for the info