How to create custom pages in dasBlog?

272 Views Asked by At

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?

2

There are 2 best solutions below

0
On BEST ANSWER

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.

2
On

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.