Recent Topics

1 Sep 03, 2005 04:59    

First of all, I'd like to say how impressed I've become with this system. I especially love the ease of multiblogging. I'm currently working with b2evo on a private test site. I think it's going to be the perfect solution for my next upcoming project.

I've done quite a bit of searching through the forums to see if there was a simple, clean, non-hacky way to have a custom template for pages that only show a single post, similar to how the Wordpress skinning system works. I couldn't find anything satisfactory, so I began to sift through the code to see if I could determine a solution.

In the end, I concluded that the simplest and cleanest way to do this is with about 4 lines of code in the _main.php file of your skin. I thought I would share this with everyone in case anyone else wants to do the same thing.

In '_main.php', just above the '< !DOCTYPE >' tag, insert these three lines:


<?php if(( $disp == 'single' ) && (file_exists( dirname(__FILE__).'/_single.php' ))) {
	require( dirname(__FILE__).'/_single.php' );
} else { ?>

Then, just below the '</ html >' tag at the bottom of the page, insert this line:

<?php } ?>

That's it. Now you can place a file in your skin folder called '_single.php', and when your visitors surf to a single post, you can present them with an entirely different look, or more likely, an significantly altered version of the same look. If at some point you decide that you don't need a different look for single posts, you can just delete the '_single.php' file, or change its name, and the system will automatically revert to the '_main.php' template.

I've only run this through a few mild tests. It's simple enough that I assume it should work fine. Please let me know, however, if there are problems that I haven't considered.

2 Sep 03, 2005 14:18

That should work well for significantly different layouts for single posts. You might take a look at the Kubrick2evo skin. It does something similar, but it doesn't use a separate file since it's only stripping out the sidebar. At any rate, good suggestion.


Form is loading...