Adding a new page to the BlogEngine

Topics: ASP.NET 2.0
Oct 11, 2010 at 10:00 PM
Edited Oct 11, 2010 at 10:01 PM

Another question...

I can see where you can easily add your code to the existing pages such as "Contact Us" or "Archives" but I need to add a "Photos" page and an "About Us" page. I'm NOT a C# programmer so adding the pages dynamically as they are in the BlogEngine is not a simple matter for me. I could just copy over my pages and insert them, but the framework is not exactly the same (although it is very similar!) In order to make the website look seamless, i gave up on trying to integrate the Blog page only into my site, but am finding it easier to integrate my client's website into the BlogEngine structure. Almost all the pages are already there - Home(Blog), Contact, Archive (I don't want a separate "Search page so I remmed that page link out) but now, I need to add an "About Us", "Classified Ads" and a "Photo Album" page.

I went into the Admin section and added two of the pages "About Us" and Classified Ads" (Haven't done the Photo Album yet - I wan these to work before I tackle adding the Photohandler to this website.) My problem is that I don't know how to get the links to point to the pages that I just added! Honestly, I would really prefer to create my .aspx pages using the main masterpage, but I am a NOT a C# programmer and haven't a clue how to get this to work. I added my top menu items like you would to a normal list item:

 

Instead of how it was coded:
<ul class="menuleft">
     <li><a class="home" href="
           <%=Utils.AbsoluteWebRoot %>" rel="home">
           <%=Resources.labels.home %></a></li>

I have:
<li class="Home"><a href="../../Default.aspx">HOME</a></li>

 

Which does work because obviously the default page already exists. Now when I add my pages for the "About Us" and the Classified Ads:

 

<li ><a href="../../AboutUs.aspx">ABOUT<br />US</a></li>

 

This does NOT work because obviously there is no existing page for it. So I hunted around to see where the pages that I created dynamically using the Control Panel and found where the XML code is stored for those pages. Question 1) How do I point my menu items to those "pages" (under the App_data/pages/b663b6a1-1c34-4c60-a891-c14772507b23.xml) OR 2) How do I create my own .aspx page to use the BlogEngine Framework (I need the columns and headers to be exactly the same in every page, so I need to use the BlogEngine framework!)

My preference is to create my own .aspx pages (they actually already exist created using VB.Net, but of course my columns and header won't be exactly the same as those used in the BlogEngine) Does this make sense? can someone please tell me how to add my own new pages to the BlogEngine Framework? Can I just use one of the Master pages? If so - which one? There is the one in the Themes section and the one in the Admin section. The reason I ask is because after looking at the root level default.aspx page, I don't see where a master page is specified, nor is there one in the contact.aspx page. Any help would be greatly appreciated.

Thanks!

Coleen

Oct 11, 2010 at 11:47 PM

I was able to create a new page using the theme master page to set my website to use the same "framework" (what I mean by that is that my columns and headers are consistent and exactly the same from page to page) and I can run them directly from Visual Studio on my local host - on a page by page basis.The URL for my localhost shows up as http://localhost/testblog/default.aspx.

However, when I start at my "Home" (default.aspx) page and try to navigate using the menu, the pages are not pointing to the relative path. In other words, in my URL I can see that instead of coming up as http://localhost/testblog/default.aspx it adds a ~ to the testblog and can then not find any of the pages. It's now looking at http://localhost:50795/testblog/~/default.aspx. How do I get it to go to the root of the testblog directory? Here is the code that I have:

<li class="Home"><a href="../default.aspx">HOME</a></li>
If I change it to use the ~/ instead of the ../ I get the exact same results. Now if I change it to ../.,/default.aspx then it points to: http://localhost:50795/default.aspx. I can see in the original code where is uses
<%=Utils.AbsoluteWebRoot %>" rel="home"><%=Resources.labels.home %>
But if I change the labels.pagename (I tried changing the page reference for the search page to point to the AboutUs page) I get an error.  What am I missing in the C# code?

Thanks for any help.

Coordinator
Oct 12, 2010 at 9:18 AM

It sounds like AboutUs.aspx is in the root folder of your blog.  This should work:

<li><a href="<%=Utils.AbsoluteWebRoot %>AboutUs.aspx">About Us</a></li>

Oct 12, 2010 at 12:02 PM

I tried that, but I was using the <%=Resources.labels.home %> and it didn't work correctly - but doing just what you posted, DID! Thank you, thank you! You are my hero! The funny thing is that the labels are so elaborate and I understand the reason for them, but to me, it's just over-kill! If this application was going to be used a a huge, world-wide blog, then it does make sense to learn how to get the labels functioning correctly (and I would like to learn, but don't have the time to right now!) Thanks VERY much!  Oh - I do have one other question on this though...

All of my pages are at the root level (I just left the structure of the blgendgine as it was), I didn't try to move it into sub folders in  my existing web application, I re-created my web application using the blogengine as the "backbone" (for now until I have time to learn how to do all of this on my own without a deadline for my client) but I DO have one page that is another directory. That page is the photoalbum, and once again I was incredibly grateful to the codeplex crew because I was able to get the photohandler app to work wonderfully. Now I have to be able to navigate to the photoalbum page in another directory. The structure is:  wwwroot/testblog/default.aspx - for the photos it will be wwwroot/testblog/photos/photoalbum.aspx - how can I get this to navigate to the photoalbum.aspx page without getting all the errors I was in my first post?

Thanks so VERY much. I hope I can learn enough to eventually be able to help others as I have been helped by those here!

Coleen


Oct 12, 2010 at 2:15 PM

I tried this: 

<li><a href="<%=Utils.AbsoluteWebRoot %>photos/Photos.aspx">PHOTO<br />ALBUM</a></li>

And I get the correct path: http://localhost:50795/TestBlog/photos/Photos.aspx but instead of pulling up my photo handler page it pulls up an error which seems to be related to the photohandler. Dang! I had the photo handler working perfectly in my VB.net application! Has anyone been able to integrate the photohandler into the blogengine? I don't see where I am missing any files associated with the photo handler (there's nothing in the bin or web.config files in my original app - it all resides in the photos directory, and I copied that over directly.) I am obviously missing something. Any help would greatly be appreciated - this is the very last step I have to finish this website for my client!

Thanks!

Oct 12, 2010 at 4:17 PM

Got it! I thought I had copied over all the references, but I missed  putting the MetaDataExtractor.dll into my Blogengine Bin file. This works great! I was able to set the path as

<li><a href="<%=Utils.AbsoluteWebRoot %>photos/Photos.aspx">PHOTO<br />ALBUM</a></li>

and it works! So if anyone else wants to use the photo handler in their Blog Engine, just make sure to copy all the files into your photo directory and don't forget to make sure you've copied the MetaDataExtractor.dll into the root level bin directory!

Thanks a bunch to all the coders at Codeplex for sharing so readily with us!

Coleen