Recent Topics

1 May 22, 2009 00:49    

My b2evolution Version: 2.x

I would like to know how I add a sidebar to my posts. I assume this is part of the skin, but dont want to change my current skin, as I have made a lot of modifications to it. The sidebar appears fine on the home page, but not on any of my posts.

My site is http://www.forevertreasures.com.au/blog

2 May 22, 2009 00:59

Hi, you will have to edit single.main.php and/or page.main.php and include this snippet...

<?php
// ------------------------- SIDEBAR INCLUDED HERE --------------------------
skin_include( '_sidebar.inc.php' );
// Note: You can customize the default BODY footer by copying the
// _body_footer.inc.php file into the current skin folder.
// ----------------------------- END OF SIDEBAR -----------------------------
?>

Refer to the index.main.php for the ideal place to "paste" it in.

Good luck

You could also just try using index.main.php and remove the others to see what happens!

3 May 22, 2009 06:19

Hi John,

Thanks for that, I have made the changes but it did not work :(

I am also unsure what you mean by

You could also just try using index.main.php and remove the others to see what happens!

4 May 22, 2009 07:05

Mmmm... index.main.php includes the sidebar.inc.php in it's templating.

.page.main and .single.main both exclude the sidebar and present a wide area for your posts.

I'm saying "temporarily" delete ( and back up) page.main.php and single.main.php and see what happens as it should default to .index.main.php with a sidebar present at all times.

I don't have the skin installed so can't test my own theory but it's worth a try.

5 May 22, 2009 07:49

OK, I have done that and the page displays fine, except instead of seeing the post, I see the below error message.

Sub template [_single.disp.php] not found.

User level 10 help info: [/home/forevert/public_html/blog/skins/evopress/_single.disp.php]

I have not backed out the change at this time, so you can see what I am talking about

6 May 22, 2009 08:05

Bummer... go back to your original set up and hope someone who's played with that skin, more than me, comes along.

7 May 22, 2009 14:03

Ah you were so close! But hey let's start at the beginning. Your skin is a customized "evopress". Most of us could probably have guessed that, but it helps to spell it out. Anyway deleting single.whatever and page.whatever was step one of a two-step process. Well, steps 1-a and 1-b ;) Step two would be on your Global settings -> skins subtab to reload the skin. I forget what the icon looks like or if it just says it with a text link, but by reloading the skin b2evo will look at the files again, see that it doesn't have a single.whatever or page.whatever file, so figure out "well heck I'll just use index.whatever and all the containers in it.

:D

8 May 22, 2009 14:40

Thanks for that EdB, unfortuantly there was no change. I still get the

Sub template [_single.disp.php] not found.

and

User level 10 help info: [/home/forevert/public_html/blog/skins/evopress/_single.disp.php]

errors. I have also found there is a sidebar2 (I am sure this is not news to most people here). Will it be possible to use this sidebar on the posts and sidebar on the home page? This will allow me to have a different set of widgets in each area.

9 May 22, 2009 14:57

OK, getting there. I went back to the original idea of adding the sidebar code to the single.main.php and page.main.php files - then reloaded the skin. This has added the sidebar, but because of the alignment of the post, in the centre, the sidebar is appearing at the bottom of the screen and my background colours are screwed up.

10 May 22, 2009 15:27

Oh that's right - the CSS changes if you are on a single post page. Let me test something real quick...

11 May 22, 2009 15:34

Okay this is quite easy after all. index.main.php is pretty much a dumb file in that skin. I think it is needed, but it is dumb so let's ignore it.

Delete single.main.php and page.main.php, then make 2 new copies of posts.main.php. Now rename the 2 copies to single.main.php and page.main.php, resulting in 3 files with different names that happen to be exactly the same. Upload the files, reload the skin, done.

ALTERNATIVELY delete index.main.php and single.main.php and page.main.php, then rename posts.main.php to index.main.php (then upload the one file and delete from your server the other 3 and reload skin) and you should get the same end result.

First method tested, second method logically correct.

12 May 22, 2009 15:41

Getting closer....

I now get the name of the post displaying twice

Birthdays And The Night You Were Born
Birthdays And The Night You Were Born
April 10th, 2009 

I have also lost the links to the next and previous posts. Is it possible to keep these? If I wanted to use Sidebar2 in the post, would it be a matter of changing

<?php
// ------------------------- SIDEBAR INCLUDED HERE --------------------------
skin_include( '_sidebar.inc.php' );
// Note: You can customize the default BODY footer by copying the
// _body_footer.inc.php file into the current skin folder.
// ----------------------------- END OF SIDEBAR -----------------------------
?>

to

<?php
// ------------------------- SIDEBAR INCLUDED HERE --------------------------
skin_include( '_sidebar2.inc.php' );
// Note: You can customize the default BODY footer by copying the
// _body_footer.inc.php file into the current skin folder.
// ----------------------------- END OF SIDEBAR -----------------------------
?>

13 May 22, 2009 15:55

Everything is possible, but honestly why not start with a skin that uses 2 columns on single post pages instead of trying to jam a second into evopress?

The title is included twice because for some reason that's the way b2evolution likes to do it: a "title" for pages other than basic blog pages. You can look in the appropriate .main.php file for something like

request_title( array(
		'title_before'=> '<h2>',
		'title_after' => '</h2>',
		'title_none' => '',
		'glue' => ' - ',
		'title_single_disp' => true,
		'format' => 'htmlbody',
	) );

and change "'title_single_disp' => true," to false. Reckon it might work...

prev/next on single post pages or multi-post pages? Anyway that is in there somewhere but I dunno where off-hand. Take a look through index.main.php and you'll see comments that help explain if it is prev/next for singles or multis, then copy out the code for singles and put it where you see fit. Then style stuff would have to be dealt with probably, but hey "get it then make it pretty" seems like a logical order eh?

On the sidebar2 thing, pretty much no but you're close. The thing is if you don't have a file called _sidebar2.inc.php then it won't do you any good to try to "skin_include" it. So you need the file ... and you will have to make your css work for whatever your sidebar2 file wants. Or make the file work with your styles I guess. I guess you could just copy or rename sidebar.foo to sidebar2.foo ... but what would be the point since you can add any widget you want to any container in the skin? (almost - some widgets don't work in some containers for some reason, and some widgets look really bad in some containers.) The thing is whatever the default stuff in sidebar2 is can be put into sidebar. Why there is even a default is beyond me, other than the failure of b2evolution to be able to deal with changing skins effectively.

Fun stuff though. MUCH nicer than editing files all the time :)

14 May 22, 2009 16:05

I would have started with a skin that did everything I needed, if I knew what I needed when I started.... I paid to have it setup the way I thought I needed it and then have made some customisations of my own. I dont feel confortable with changing the skin to another and then trying to replicate the customisations I paid for (particually as I am not sure what was changed).

My intention is not to have both sidebars running together, but rather one on the main page and another on the posts, allowing different items in the side bar for each. I will have a play and see what I can come up with. Yes I agree, make it work then make it look nice.

I am going to head off to bed now but will have more of a play tomorrow. Thanks for your help so far :)

15 May 24, 2009 23:39

Thanks for your help EdB & John, after coping sections from the old copies of single.main.php and page.main.php to the versions of these files I copied from index.main.php, the blog is now formatted the way I want. Thanks again :)


Form is loading...