3

I know I've seen this in the past, but I can't seem to find it now.

Basically I want to create a page that I can host on a dasBlog instance that contains the layout from my theme, but the content of the page I control.

Ideally the content is a user control or ASPX that I write. Anybody know how I can accomplish this?

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
Ben Scheirman
  • 40,531
  • 21
  • 102
  • 137

2 Answers2

4

The easist way to do this is to "hijack" the FormatPage functionality.

First add the following to your web.config in the newtelligence.DasBlog.UrlMapper section:

<add matchExpression="(?&lt;basedir&gt;.*?)/Static\.aspx\?=(?&lt;value&gt;.+)" mapTo="{basedir}/FormatPage.aspx?path=content/static/{value}.format.html" />

Now you can create a directory in your content directory called static. From there, you can create html files and the file name will map to the url like this:

http://BASEURL/Static.aspx?=FILENAME

will map to a file called:

/content/static/FILENAME.format.html

You can place anything in that file that you would normally place in itemTemplate.blogtemplate, except it obviously won't have any post data. But you can essentially use this to put other macros, and still have it use the hometemplate.blogtemplate to keep the rest of your theme wrapped around the page.

Nick
  • 5,875
  • 1
  • 27
  • 38
1

I did something similar setting up a handler to stream video files from the blog on my home server. I ended up ditching it because it killed my bandwidth whenever someone would view a video, but I did have it up and working for a while.

To get it to work I had to check dasBlog out from source control and open it in visual studio. I had VS2008 and it was built using VS2005, so it took some work to get everything to build. Once I could get the unaltered solution to build I added a new class library project to hold my code. This is to make sure my code stays separate across dasBlog updates.

I don't have access to the code here at work so I can't tell you exact names right now, but if you want your pages to be able to use the themes then they need to inherit from a class in the newtelligence.dasBlog.Web namespace, and I believe also implement an interface. A good place to look is in FormatPage and FormatControl.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
  • I'm pretty sure there's an easier way that doesn't require dasBlog source. I'll keep it in mind, though, in case I'm wrong. – Ben Scheirman Sep 08 '08 at 15:56
  • In theory you can just grab the compiled .dll and add a reference to that in your own project, but you _will_ need to use some of the dasBlog objects. With that in mind, having source available to reference just makes things easier. – Joel Coehoorn Sep 09 '08 at 14:17