Recent Topics

1 Mar 18, 2005 00:30    

I am operating an istallation where most users would get a blog and a link blog. I've hidden the linkblogs that I've set up by not including in the blog list. However the entries in the link blogs still show up in the BLOG ALL which is a shame as I want to use the blogall to aggregate all the postings but i don't want to see the linkblogs in there too.

I know how to hide blogs in php but I don't want to do that as it will mean editing code everytime a new blog and associated link blog gets created. Is there any way to keep the contents of these blogs from appearing in the blogall

2 Mar 23, 2005 08:06

Well, 31 people have looked at this but still now answers so I gues there mustn't be an answer.

I figured out a workaround. I'll create a dozen or so "reserved" blogs for potential future link blogs and hide em all at once. This beats doing it one by one. There's still a bit I need to know. I know how to hide blogs by number in php but I don't know how the ALL blog does its stuff. It works in ANY skin so I'm not sure what to edit to stop link blogs appearing in the aggregated list of postings

3 Mar 23, 2005 08:59

you could do probably something like this

if (($Item->get('main_cat_ID') == '143' || $Item->get('main_cat_ID') == '144')&& $disp != 'single') 
{ ?> 
   // do the things you want with those cats you don't want to show	

<?php } 
{ ?> 
// the normal behavior
<?php } // end it ?> 

perhaps .... ?

4 Mar 23, 2005 11:32

where does that go then? in main.php ??

If by cat you mean catgories it's not categories I want to hide it's whole blogs but I guess it could ammount to the same thing

5 Mar 23, 2005 12:40

it is not possible to test if a post is in some blog
you can only test if it is in a category..

And yes
in _main.php

6 Mar 23, 2005 17:35

sorry to be dumb - I've used the hack and I can certainly address the categories. I'm not sure how to hide them though.

7 Mar 23, 2005 19:53

hide them -> not show them :)

you do a if then else
the else statement : categories with nothing special in it.
so, show them like normal post

the if statement : special categorie (special because in a link blog)
do'nt do anything.. so don't show them, so .. hide them...

8 Mar 23, 2005 20:57

sorry, I'm just not getting it

well partialy cos I can pull out a category but all I've managed to do is apply some annotation to them but I'm not sure how to hide them

here's what I've done

results can be seen here

<?php // ------------------------------------ START OF POSTS ----------------------------------------

if( isset($MainList) ) $MainList->display_if_empty(); // Display message if no post

if( isset($MainList) ) while( $Item = $MainList->get_item() )
<div lang="<?php $Item->lang() ?>">
$Item->anchor(); // Anchor for permalinks to refer to
locale_temp_switch( $Item->locale ); // Temporarily switch to post locale
if (($Item->get('main_cat_ID') == '12' || $Item->get('main_cat_ID') == '12')&& $disp != 'single')
{ ?>
// hide these posts
<?php }
{ ?>
// show these
<?php } // end it ?>
<div class="centerTitle"><?php $Item->title(); ?></div>

<div class="centerContent">
<p class="clickon">(click on title to hear the broadcast)</p><br/><br/>
<div class="centerDate"><?php $Item->issue_date(); ?> -

<?php $Item->content(); ?>
<?php link_pages() ?>


9 Mar 25, 2005 04:47

I was looking for something to do this and found this thread.

I found that the categories are unique to each blog. So if you were to hide all the categories for a given blog you would in effect hide the blog.

I found two ways of accomplishing this.

The first way is to modify the itemlist query that handles the All Blog:

Look in /b2evocore/_class_itemlist.php at line 486 and you'll see the following:

		if( $blog == 1 )
		{ // Special case: we aggregate all cats from all blogs
			$this->request .= 'WHERE 1 ';

I modified this block as follows:

		if( $blog == 1 )
		{ // Special case: we aggregate all cats from all blogs
			$this->request .= 'WHERE 1 ';
			// hack to exclude specific blog cats from all blog aggregator
			// note: category IDs are specific to blogs, so by restricting a cat you restrict the blog
			$this->request .= 'AND cat_blog_ID <> 9 ';
			$this->request .= 'AND cat_blog_ID <> 8 ';
			$this->request .= 'AND cat_blog_ID <> 7 ';

The cat_blog_ID values I'm excluding correspond to the blog ID values for my linkblogs and another blog I want hidden from the All Blogs list.

The second method is to modify the /skins/<skin name>/_main.php:

Directly under this code:

	if( isset($MainList) ) while( $Item = $MainList->get_item() )

I added the following:

	if ($Item->get('main_cat_ID') != '20' ) {

The main_cat_ID corresponds to the post_category field in the posts table.

Then at the end of the posts section I added an extra } to close the added block, so the last line of the post section looks like this:

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

Both work just fine on my site.

I think the main difference between the two implementations is that modifying the query itself in the itemlist class would be a global change that affects all skins, while the _main.php method only affects that particular skin.

Now, my blogsite is small and I don't expect it to really grow much, so the manual hack works fine for my purposes. If you have a more dynamic situation then you would certainly want to consider a more elegant solution.



10 Nov 01, 2005 18:04

sorry for stupid question but if i have category x then where i must put it in the code?

Form is loading...

Photo gallery software – This forum is powered by b2evolution CMS, a complete engine for your website.