Download: blog2.php.txt

Downloading: blog2.php.txt Stub File

A Stub File is a placeholder file that will make a particular Blog or Collection live in a particular place of your website.

For example you could create a stub file called myblog.php at the root of your website so that your blog could be accessed at http://www.mydomain.com/myblog.php .

  • Older versions of b2evolution ship with files named blog1.php to blog7.php in the root directory.
  • Newer versions of b2evolution don’t ship with stub files any more. They are configured by default to recognize all collections as extra-parameters on ├Čndex.php`.

You can download a sample stub file from this page or you can copy/paste the sample provided below. Rename it to whatever you want and make sure the extension is .php once you upload it to your website. (not .php.txt which is only to make download and editing convenient.)

IMPORTANT: in addition to placing the stub file on your site, you will also need to configure the collection/blog’s base URL accordingly.

Exemple of contents of a stub file:

PHP

<?php
/**
 * This is a stub file for displaying a b2evolution blog.
 *
 * A stub file is used to anchor a particular blog in a particular location of your website.
 */
 
# 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;
 
# You could *force* a specific skin here with this setting: (otherwise, default will be used)
# $skin = 'custom';
 
# This setting retricts posts to those published, thus hiding drafts.
# You should not have to change this.
$show_statuses array();
 
# Additionnaly, you can set other values (see URL params in the manual)...
# $order = 'ASC'; // This for example would display the blog in chronological order...
 
/**
 * That's it, now let b2evolution do the rest! :)
 * Note: if you put this file in a subdirectory, you will need to adjust the path below, for example:
 * require_once dirname(__FILE__).'/../conf/_config.php';
 */
require_once dirname(__FILE__).'/conf/_config.php';
 
require $inc_path.'_blog_main.inc.php';
?>

If you want more information about stub files, please read: Introducing Stub Files