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 :-


 * 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 :-


// 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(
        $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 :-


        if( !empty($this->ItemQuery->where) )
            $where 'WHERE '.$this->ItemQuery->where.$where;
            $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? ;)



Paged comments

7th Feb 2006 ¥åßßå

Taming Long Comment Lists

Does your blog receive lots of comments? If so, you're probably tired of scrolling down the screen each time you want see the newest comments. ( We know we are. :p ) Tame your long list of comments by paging them.

This skin modification will help you get control over lots of comments by putting them into pages. You can control the following:

  • Number of comments per page.
  • Sort order (New-to-old or old-to-new).
  • Styling and/or number of page controls.

The way it works is simple. Your comments appear, as normal, until they exceed your "number of comments per page". When they go over, a comment page is added, with page controls (i.e., newer comments | older comments ). The controls appear where you place them and we've added hooks so that you can style them to your liking in your CSS file. The code includes an internal bookmark, so when you scroll through pages of comments, each new page starts at the "top of comments" (rather than "top of entry"), which makes reading multiple pages of comments easier. We have also included an optional, easy core hack to keep view counts from incrementing for comment pages, should this be something you need.

To implement paged comments for your blog, follow the detailed instructions & use the cut'n-paste code on the next page. After you're finished installing, you'll likely want to style the page controls, which is covered on page 3 (CSS Styling), including some suggested CSS declarations. The last page (FAQs and Enhancements) discusses any questions we've received about paged comments and additional ways to make paged comments nicer.

  1. Introduction
  2. Installation instructions
  3. CSS Styling of Page Controls
  4. FAQs & Enhancements

Allowing Longer URLs for Permalinks

15th Jan 2006 stk
Question & No-hack Options

A member asks, "Can I change the maximum allowed length for permalink URLs?"

The answer: YES

We present three possible solutions. Two do not involve a core hack. If you want the hack option, follow the easy step-by-step directions. Both the pre-Phoenix versions of b2evolution (v0.9.0.x) and post-Phoenix versions (v1.6+) are covered. We also take a look at the believe that having a longer permalink URL helps page rankings (i.e., SEO). You might be surprised by the information presented.

We hope that you find this article useful and appreciate your questions and feedback.

Question from a member:

Where can I change the maximum allowed length (in characters) of the permalinks for a post?

There appear to be three possible solutions:

  1. Don't use really long URL's Long URLs are ugly, using them isn't doing your visitors any favors and long URLs can break in an email (a broken URL is an unlinked URL). Generally speaking, URLs should be short, easy to type and unique.

    You can specify a long title (e.g., Watch Me Kill The President! (Jan 13) "Ridiculous In America" on ABC ), but then a shorter "URL Title" (e.g., killing_the_president). There is a spot for this in the Back Office. You don't HAVE TO use your title as the default "URL Title". Many people do this when they have a long title.

    We recommend this 'short URL' solution over anything else.

    HOWEVER ... search engines parse the title for words .. (not sure how they handle the underscores) but you *might* end up with better rankings with a long (and descriptive) title. (We've discovered some interesting information regarding rankings and URLs, which you can read about on the last page, below).

  2. Use "Post called up by its URL title". A possible solution if your server supports "clean urls" or "extra-path info". (To set this option in the back office, go to ... settings --> Link Options --> select the "Use extra-path into" box.

    Instead of "URL title", try "Post on archive page, located by it's title". This may achieve most of what you're looking for, as it yields the full title in the URL and doesn't require any core file hacking.

  3. Hack your b2evolution installation to allow for longer URLs. There are some changes you must make to enable really LONG urls. Here's what you do ...(depending on which version you have, select the correct page, below). Unsure?

  1. Question & No-hack Options
  2. Dawn (v0.9.1.0) or Earlier
  3. Phoenix (v1.6 Alpha) or Newer
  4. Longer URLs & Page Ranking