Recent Topics

1 Feb 01, 2005 03:14    

I just set this up on my own blog.. its called Matt's Asides (for WP users).
You can see it in action on my own blog (click the signature below) -- just look for posts that are in grey
I like snips better, and I've successfully set it up on my b2evo blog -- I will give directions, but they are obviously specific to the skin I am using.. with a little poking around though any skin could be done like this. I have included reference lines so you can see what comes after the edits in hopes that makes things easier.

Snips, by the way, are those little thoughts that might not warrant a whole ton of post meta info-- like I said .. just see my site for how ive implemented them.

so anyway..

1. Set up the new category you want to use for your snips. After you have done that you need to get the category #. You can get that by going into your backoffice, hitting your categories tab, and mousing over OR clicking the category you want to use.. You should see a URI like :

http://www.yourdomain.com/b2evo/admin/b2categories.php?action=Edit&cat_ID=14

The #, in this case, 14 is your snips category. Remember that #

2. File edits:

_main.php inside your skins needs a couple changes

First file edit:

Find the start of the loop ...


<?php // ------------------------------------ START OF POSTS ----------------------------------------
	if( isset($MainList) ) $MainList->display_if_empty(); // Display message if no post

	if( isset($MainList) ) while( $Item = $MainList->get_item() )
	{
		$MainList->date_if_changed();
	?>

Immediately underneath that, put the following:


<?php if ($Item->get('main_cat_ID') == '14' && $disp != 'single') { ?>
<div class="snip" lang="<?php $Item->lang() ?>">
<?php locale_temp_switch( $Item->locale ); ?>
<?php $Item->content(); ?>
<?php $Item->commentlink( 'comments' ) ?>
</div>
<?php } else { ?>

Notice in the code above (first line), I have inserted the category #, which I said earlier for the sake of example was 14. What this code does is look specifically for posts in that category, and display them a little differently-- we just set up a new class named snip.

For reference, the next immediate line after that edit (on my skin, atleast, is:


<div class="post" lang="<?php $Item->lang() ?>">

2nd file edit:

Scroll down to where the loop is ending.. you should see something similar to:

// ---------------- END OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. ----------------

	locale_restore_previous();	// Restore previous locale (Blog locale)
	?>
</div>

Immediately after that you need:


<?php } // end it ?>

For reference, the next line after that inserted line, is the end of the loop


<?php } // ---------------------------------- END OF POSTS ------------------------------------ ?>

----

That's it for file edits.

The last thing you need to do is figure out how you want your div to be displayed and add the class to your css files for all your skins. Note that you do not have to use a div, you could use a list or just a span..

Other minor details:
When viewing your blog in paginated view...obviously the post meta data is not there. If you click the comment link the singke page view kicks in and all of the post meta data is displayed, including trackbacks, etc..

I can provide access to anyone who needs to see this working on a b2evo blog, but would rather not have the URL wide open since it is largely just a mess around with code blog. Like I said above, it looks EXACTLY like my WP blog, even the same skin.

I should add too that the b2evo version I have this working on is 0.9.0.11

2 Feb 01, 2005 03:25

I swore but was wrong when I went back and searched that I had seen a question about displaying posts within certain categories differently.. Obviously, this code could be used to display ALL or any of your categories differently in paginated view, if you were so inclined.. a few if statements would do the trick quite nicely

I also neglected to mention that by category, I mean the MAIN category (the round checkbox) not the square one :)

Im sleepy, so Im (just) hopeful I covered everything. Remember to back up your files!!

3 Feb 01, 2005 03:33

Hey that's neat!

Edit: just saw your second. Reckon if you had more than one cat the snip wouldn't show up until someone clicked the subcat link, then would show up as a snip. Main cat being main cat and all that. Rat a tat tat.

4 Feb 01, 2005 03:37

yeah i know, i looked at my == and figgered it out, hence the edit :)

Im off, sleepytime, work is a bitch

5 Feb 02, 2005 01:29

by the way, I would LOVE to see how anyone else implements this.. as well as how they have styled the diff CSS class. So if you set up snips and wish to share, drop me a pm if youre not into posting your URL for all to see. I promise not to tell

7 Feb 04, 2005 11:54

heh nice! I thought about using some sort of punctuation, good job! :)

8 Feb 10, 2005 15:55

:D Love it! thanks.

It'll take some getting used to - knowing when to snippet or not.... :lol: but I think it'll definitely be used a LOT

If you want to see what I did with it click on over to

[url=http://www.sunset.000k2.com/cc/]Chaotic Clarity[/url]

9 Feb 11, 2005 03:37

cool! I'm glad you like it, theyre great for those little things that dont need a lot of room! :D

10 Feb 12, 2005 16:52

you can see it in action at my site (on day 12 februari 2005)

11 Feb 13, 2005 16:09

Yep - I still like this hack :D

I like it so much that I was wondering how easy it would be to use it again? I have it for 'snippets' but what if I want another category such as, say, 'tips' - with different css?

Easy, difficult, impossible?????

12 Feb 13, 2005 16:15

I think that would be easy to inplement.
I'm not shure if it would be very efficient to have a lot of select cases...

but it shure would work

13 Feb 13, 2005 16:18

Just looked at the hack again - would it just be a case of entering a new category ID? - I think I might give it a go (making a backup of my files just in case) and see what happens. :)

edit: second thoughts - I need some guidance on this... just don't know how to put in the second if statement... this is the first time I have been scared to screw around with code - I am no good at it really but I like to experiment... perhaps I'll get the nerve up at some point! :lol:

14 Feb 13, 2005 17:01

I just did something with this :


if( isset($MainList) ) while( $Item = $MainList->get_item() )
	{
		$MainList->date_if_changed('<div class=\'style_date\'>','</div>','d F Y');
	?>
	<?php if ($disp != 'single' )
	{
		switch( $Item->get('main_cat_ID'))
		{
			case 143: ?>
				<div class="snips" lang="<?php $Item->lang() ?>"> 
					<?php locale_temp_switch( $Item->locale ); ?> 
					<div class="bPostTitle"><?php $Item->main_category(); ?></div>
					<?php $Item->content(); ?> 
				</div> 
			<?php 	break;
			case 136: ?>
				<div class="tips" lang="<?php $Item->lang() ?>"> 
					<?php locale_temp_switch( $Item->locale ); ?> 
					<div class="bPostTitle"><?php $Item->main_category();  ?></div>
					<?php $Item->content(); ?> 
				</div> 
			<?php	break;
			case 118: ?>
				<div class="wordoftheday" lang="<?php $Item->lang() ?>"> 
					<?php locale_temp_switch( $Item->locale ); ?> 
					<div class="bPostTitle"><?php $Item->main_category(); ?></div>
					<?php $Item->content(); ?> 
				</div> 
			<?php	break;
			default  ?> 
	  <div class="bPost<?php $Item->disp('status', 'htmlattr'); ?>" lang="<?php $Item->lang() ?>">
		


the normal stuff

	  </div>
	  <?php	break;
	}
}
?>
  <?php } // ---------------------------------- END OF POSTS ------------------------------------ ?>
   

it is not 100% correct, because I did my test of the $disp single wrong....

15 Feb 13, 2005 19:41

actually per category CSS changes were brought up before ..could be done that way

http://forums.b2evolution.net/viewtopic.php?t=3088&highlight=category+css

the trick is to make sure that cats that you dont want to use an alternate style for use the defualt class, so you would need to use an if == 'changed cat' statement than something along the lines of an else if !='changed cat'

im glad people like this and that it's faciilitated some other ideas :D


Form is loading...