Take control of your Blog All

26th Dec 2006 ¥åßßå

This hack allows you to choose which blogs appear in your all blog, which is quite useful if you run a multi-user blog system as each user can have their own Blog All (which could include their main blog and linkblog etc)

Probably the best way to do this is by using a pseudo stub file for each blog all

Create a stub with the following code :-

PHP:

<?php
/**
 * This file is a stub file for displaying a blog, using evoSkins.
 *
 * This file will set some display parameters and then let b2evolution handle
 * the display by calling an evoSkin. (skins are in the /skins folder.)
 *
 * Note: You only need to use this stub file for advanced use of b2evolution.
 * Most of the time, calling your blog through index.php will be enough.
 *
 * Same display without using skins: a_noskin.php
 *
 * b2evolution - {@link http://b2evolution.net/}
 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
 * @copyright (c)2003-2006 by Francois PLANQUE - {@link http://fplanque.net/}
 *
 * @package evoskins
 * @subpackage noskin
 */
 
# First, select which blog you want to display here!
# You can find these numbers in the back-office under the Blogs section.
# You can also create new blogs over there. If you do, you may duplicate this file for the new blog.
$blog 2;       // 2 is for "demo blog A" or your upgraded blog (depends on your install)
 
# You could *force* a specific skin here with this setting: (otherwise, default will be used)
# $skin = 'basic';
 
# This setting retricts posts to those published, thus hiding drafts.
# You should not have to change this.
$show_statuses array();
 
# You could *force* a specific link blog here with this setting: (otherwise, default will be used)
# $linkblog = 4;
 
# This is the list of categories to restrict the linkblog to (cats will be displayed recursively)
# Example: $linkblog_cat = '4,6,7';
$linkblog_cat '';
 
# This is the array if categories to restrict the linkblog to (non recursive)
# Example: $linkblog_catsel = array( 4, 6, 7 );
$linkblog_catsel array( );
 
# Here you can set a limit before which posts will be ignored
# You can use a unix timestamp value or 'now' which will hide all posts in the past
$timestamp_min '';
 
# Here you can set a limit after which posts will be ignored
# You can use a unix timestamp value or 'now' which will hide all posts in the future
$timestamp_max 'now';
 
# Additionnaly, you can set other values (see URL params in the manual)...
# $order = 'ASC'; // This for example would display the blog in chronological order...
 
<span style="color:red">/*</span>
<span style="color:red"> * Pick your blogs</span>
<span style="color:red"> */</span>
 
 
<span style="color:red">$am_blog_all['include_blogs'] = array(31,119); //array of blog ID's to include in the pseudo blog all</span>
<span style="color:red">$blog=1// don't change this or your blog will wander off to another dimension</span>
 
 
/**
 * That's it, now let b2evolution do the rest! :)
 */
require_once dirname(__FILE__).'/conf/_config.php';
 
require $inc_path.'_blog_main.inc.php';
?>

Next, crack open inc/_blog_main.inc.php and make the following change :-

PHP:

// Note: even if we request the same post, the following will do more restrictions (dates, etc.)
<span style="color:red">    if( empty( $am_blog_all ) ) $am_blog_all array();</span>
    $MainList = & new ItemList(
        $blog$show_statuses$p$m$w$cat$catsel$author$order,
        $orderby$posts$paged$poststart$postend$s$sentence$exact,
        $preview$unit$timestamp_min$timestamp_max$title$dstart<span style="color:red">, '#'$am_blog_all</span> );

Finally, crack open inc/model/_itemlist.class.php and make the following changes :-

PHP:

// FINALIZE WHERE CLAUSE:
        if( !empty($this->ItemQuery->where) )
        {
            $where 'WHERE '.$this->ItemQuery->where.$where;
        }
        else
        {
            $where 'WHERE 1 '.$where;
        }
 
<span style="color:red">        if( !empty( $params['include_blogs'] ) ) $where .= ' and cat_blog_ID in ('.implode','$params['include_blogs'] ).')'// we want to restrict to multiple blogs</span>
        /*
         * RUN QUERY NOW:
         */

Cool huh? ;)

¥

 
 
 
 

Weather

15th Dec 2006 Danny
Introduction

Plugin updated 20th Jan 2008 - Please ensure you have the latest version installed

Weather is a plugin for b2evolution that adds data from weather.com to your blog sidebar. Just enter your city name or zip code in the Tools tab, along with what data you want to see, then add a bit of code to your skin and you'll have automatically updating, cached weather data, including an icon.

Contents
  1. Introduction
  2. Installation (v1.8)
  3. Installation (v2.2+)
  4. Customization
 
 
 
 
 

B.O.P.I.T