Recent Topics

1 Jun 14, 2005 23:03    

All:

b2evo and it's predecessor, b2, are excellent blogging tools. Just thought I'd get the arse-kissin' outa the way early on.

Here's what I'd like to do:

the "all blog" or the "aggregator blog" (aka Blog #1) shows a link of all my blogs in the sidebar, along with their categories.

I know I'm just being dense. I've done several searches here on the forums, and tried to figure out the interaction between _bloglist.php and _multiblog.php and _main.php, but I'm just not getting it.

I'd like to have that sidebar list of all blogs and categories listed on all my blogs. I'd prefer to do it dynamically, so that if I add a blog via the back office, or a category to a blog, or delete one, that all the links will update. In otherwords, I don't want to have to code all those links directly using html.

Can someone point me to a previous post where this is discussed, or perhpas give me some thoughts on what files I should be looking to modify?

I'm a PHP neophyte, but I'm fairly good with coding/programming in general.

Thanks.

2 Jun 15, 2005 11:24

I haven't tried it myself but...

What is happening with the _categories.php thing in your _Main.php is that it is showing all categories from the current blog, including the blogtitle.
On blog 1 it is showing all categories.. and that is all blogs.

So if you could force the show the categories from blog 1 on every blog, that that would be ok.

Look into the multiblogs.php file for an example on how to 'force' the blognumber.

3 Jun 15, 2005 14:25

Topanga:

Thanks!

I hadn't realized that the 'blogs' are themselves 'categories' as far as blog #1 is concerned.

That's a huge help, and I think I can make it work now.

Excellent.

5 Jul 31, 2006 00:36

I think you want to use the world-famous "dirty trick". In your skins/skinname/_categories.php or your skins/_categories.php you will want to wrap the guts of how it does it's thing in the dirty trick. Basically find the file that has this in it:

	// ----------------- START RECURSIVE CAT LIST ----------------
	cat_query();	// make sure the caches are loaded
	if( ! isset( $cat_array ) ) $cat_array = array();
	
(all kinds of other stuff in here that you don't need to mess with)
	
	// End global list:
	echo $cat_main_end;

	// ----------------- END RECURSIVE CAT LIST ----------------

?>


Now make it be like this:

	// ----------------- START RECURSIVE CAT LIST ----------------

// Start the Dirty Trick!
$saved_blog = $blog;
$blog = 1;

	cat_query();	// make sure the caches are loaded
	if( ! isset( $cat_array ) ) $cat_array = array();
	
(all kinds of other stuff in here that you don't need to mess with)
	
	// End global list:
	echo $cat_main_end;

// End the Dirty Trick!
$blog = $saved_blog;

	// ----------------- END RECURSIVE CAT LIST ----------------

?>

6 Jul 31, 2006 01:03

My categories.php in the themes lok like this

/*
* WARNING: the category list is displayed recursively.
* This is a little tricky. Don't modify below unless you really know what you're doing!
*/

// ----------------- START RECURSIVE CAT LIST ----------------
cat_query(); // make sure the caches are loaded
if( ! isset( $cat_array ) ) $cat_array = array();

/**
* callback to start sublist
*/
function cat_list_before_first( $parent_cat_ID, $level )
{ // callback to start sublist
global $cat_group_start;
if( $level > 0 ) echo "\n",$cat_group_start,"\n";
}

/**
* callback to display sublist element
*/
function cat_list_before_each( $cat_ID, $level )
{ // callback to display sublist element
global $blogfilename, $cat_array, $cat_line_start, $cat_line_checkbox;
$cat = get_the_category_by_ID( $cat_ID );
echo $cat_line_start;
if( $cat_line_checkbox )
{
echo '<label><input type="checkbox" name="catsel[]" value="'.$cat_ID.'"';
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo ' checked="checked"';
}
echo ' />';
}
echo '<a href="'.url_add_param( get_bloginfo('blogurl'), 'cat='.$cat_ID ).'">'.format_to_output($cat['cat_name'], 'htmlbody').'</a> <span class="dimmed">('.$cat['cat_postcount'].')</span>';
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo "*";
}
if( $cat_line_checkbox )
{
echo '</label>';
}
}

/**
* callback to display sublist element
*/
function cat_list_after_each( $cat_ID, $level )
{ // callback to display sublist element
global $cat_line_end;
echo $cat_line_end,"\n";
}

/**
* callback to end sublist
*/
function cat_list_after_last( $parent_cat_ID, $level )
{ // callback to end sublist
global $cat_group_end;
if( $level > 0 ) echo $cat_group_end,"\n";
}

// Start global list:
echo $cat_main_start;
if( $blog > 1 )
{ // We want to display cats for one blog
echo "\n",$cat_group_start,"\n";

if( !empty( $cat_all ) )
{ // We want to display a link to all cats:
echo $cat_line_start,"\n";
echo '<a href="',get_bloginfo('blogurl'),'">',$cat_all,'</a>';
echo $cat_line_end,"\n";
}

cat_children( $cache_categories, $blog, NULL, 'cat_list_before_first', 'cat_list_before_each', 'cat_list_after_each', 'cat_list_after_last', 0 );

echo "\n",$cat_group_end,"\n";
}
else
{ // We want to display cats for all blogs
for( $curr_blog_ID=blog_list_start('stub');
$curr_blog_ID!=false;
$curr_blog_ID=blog_list_next('stub') )
{ # by uncommenting the following lines you can hide some blogs
// if( $curr_blog_ID == 2 ) continue; // Hide blog 2...

if( ($curr_blog_ID == 1) && empty( $cat_all ) ) continue; // Hide blog 1 if requested

echo $cat_blog_start;
?><a href="<?php blog_list_iteminfo('blogurl', 'raw') ?>"><?php blog_list_iteminfo('name', 'htmlbody') ?></a>
<?php
echo $cat_blog_end;

// run recursively through the cats
cat_children( $cache_categories, $curr_blog_ID, NULL, 'cat_list_before_first', 'cat_list_before_each', 'cat_list_after_each', 'cat_list_after_last', 1 );
}
}

// End global list:
echo $cat_main_end;

// ----------------- END RECURSIVE CAT LIST ----------------

?>

I am copletly lost what to change

7 Jul 31, 2006 01:12

There is no need to post an entire file because everyone who might answer already knows what they contain. We've got the same files right? ;)

So look at your file and look at what I showed you. You do not change anything - you ADD 3 lines near the top and 2 lines near the end.

8 Jul 31, 2006 01:22

Yes you have right sorry , not need to show that file :oops:

I get this error when i input the code

necessities/www/blogs/skins/wpc_blank/_categories.php

9 Jul 31, 2006 02:06

I've never dealt with the WPC_* skins that much but will venture a guess here. In your skins/wpc_blank folder you have a file called _categories.php? It ends with something like this?

	/*
	 * We now call the default categories handler...
	 * However you can replace this file with the full handler (in /blogs) and customize it!
	 */
	require get_path('skins').'/_categories.php';

?>

So you should look at skins/_categories.php and make the additional bits happen in that file. Hopefully that'll get you going. If not then let's hope someone who is familiar with those skins comes along and gives a good answer...

10 Jul 31, 2006 11:26

Hi it´s working , I copy the categories.php in skins folder and put it in my theme and change like you say.

// Start the Dirty Trick!
$saved_blog = $blog;
$blog = 1;

// End the Dirty Trick!
$blog = $saved_blog;

Thank you for youre help :lol:


Form is loading...