Recent Topics

1 Aug 19, 2008 08:49    

My b2evolution Version: 2.x

I picked 2.x for my version so now we'll know if this forum handles that detail correctly ;)

Has anyone figured out how to do skin features based on main cat within a blog? For example I know I can do a "no sidebar on single post" feature for a skin and a skin is applied to a blog. I know I can add a new blog to pick a skin that looks pretty much the same but might use a sidebar for single posts. The thing I would like to do though is pick some features of the skin based on the main cat the post is attached to.

So like dig this: you have 5 bloggers who have their own blog. All posts are aggregated to blog #1. Each blogger has a category called, for example, photos. This would be for posts that really highlight their photographic awesomeness. For any post with a main cat other than photos you want to do a sidebar, and the skin does that. For posts with the main cat of "photos" (knowing that it would actually be 5 different cat_ID numbers) you want to make the sidebar be more like a footer ... or non-existent. That way the resizing feature of linked images can showcase the images better.

Anyway I've no idea how to do it so figured I'd ask if it had been done, where "it" is 'tweaking a skin based on main cat selection'.

2 Aug 19, 2008 16:48

I don't understand exactly what you need, I hope this might be helpful.

$main_cat = get_the_category_by_ID( $Item->main_cat_ID, false );
if( empty($main_cat['cat_parent_ID']) )
// you're in parent category

if( !empty($main_cat['cat_parent_ID']) )
// you're in sub category



global $cat;
$current_cat = get_the_category_by_ID( $cat, false );
if( $current_cat['cat_name'] == 'photos' )
// do whatever you want for photos category

3 Aug 19, 2008 19:51

Yeah the third does the trick. I'll test it when I get a round tuit but what I want to do is put it in the <head> section so I can pick a style sheet based on the main cat name. Like the third bit you showed eh?

That way IF a post is in a category named "photos" then I can ditch the sidebar and widen up the main column. With an appropriate 'fit_image_width_thing_trick'.

I think... ;)

4 Aug 19, 2008 20:02

<?php
if( !empty( $cat ) )
{
  switch( $cat )
  {
    case 1:
      // do summat
      break;

    case 2:
      // do summat
      break;

    case etc:
      // do summat
      break;

    default:
      // do summat ... or not, up to you
      break;
  }
}
?>

¥

*edit*
Actually, I'm talking bollocks, that'd only work if the visitor clicked to view a category :-S

Ahhh well .. not the first time I've talked bollocks ... and certainly won;t be the last :p


Form is loading...