He has not learned the lesson of life who does not every day surmount a fear... ~Ralph Waldo Emerson
23 November 2007
Written by
Yours Truly (

)
Published on November 23rd, 2007 @ 06:31:30 pm, using 1322 words, 29350 views
I’ve been using b2evolution as my blogging platform for several years now, and have always found the default template switcher located in the sidebar to be, well, boring. It’s a text-based list that shows the various skins available on a b2evo blog from which that blog’s readers can select to customize their reading experience. The operative words here are “text based list". Clever skin names aside, it does little to show the reader what a template actually looks like before being selected, and eye-candy is always welcome, right? With this in mind, I set about putting together a more visually intuitive way of displaying to the user what b2evo skins look like, without that user actually having to switch to that skin in order to see it.
What I came up with is a small piece of PHP code which renders a tiled list to display thumbnails of each b2evo skin, replacing the boring, and uninformative, text list. At the time of this writing, the tiled list can be seen in action in the sidebar of each skin on this blog.
If you’d like to implement a similar list on your own b2evolution blog, you’ll need a few things first… Since I’m providing you with the code here, you’ll need the ability to copy and paste text from one file to another. Simple enough, yeah? Second, you’ll need some kind of graphics editing program, such as Adobe Photoshop or the free GIMP software, which is actually a pretty powerful piece of software. In any case, you’ll need some kind of graphics program in which to create the thumbnails to be displayed in the list…
Alright, on with the show…
Read the full text of this post...
05 August 2007
Written by
Yours Truly (

)
Published on August 5th, 2007 @ 07:25:20 pm, using 288 words, 20738 views
A while back I found myself needing the ability to uniquely identify each blog on my b2evolution system. I wanted to be able to display blog-specific CSS styles and header imagery, while using the same b2evo skin across the entire site, rather than developing slightly varied skins for each blog.
The solution is rather simple, and allows each blog to be styled uniquely, while still allowing the remaining stylesheet definitions to cascade over elements which are not called by the unique identifier. So... on to the code...
Adding the following code to your b2evo skin's /skinname/_main.php file will cause the 'body' tag to be ID'd with the '$blog_shortname' of the specific blog. Essentially, this will ID the body tag as id=1 for Blog All, id=2 for Blog A, and so on....
The following code will work on b2evo 0.9.x...
<body id="<?php echo $Blog->disp( 'shortname' ) ?>">
...and the following code works in b2evolution 1.10.x...
<body id="blog<?php echo $blog ?>">
Once this code has been implemented in the _main.php file of your favorite b2evo skin, you can assign blog-specific styles to your CSS stylesheet as so:
body#blog2 #header {
background: #000 url(images/blog2header.jpg) top center no-repeat;
text-align: left;
}
body#blog3 #header {
background: #000 url(images/blog3header.jpg) top center no-repeat;
text-align: right;
}
The CSS style shown above works with the second PHP example, and can be used in b2evolution 1.10.x blogs...
Contemporaneous Auditory Narcotics:
or, What my speakers are currently pumping...
Decoder & Substance - Heist / Curvature
This post is the creative work of Yours Truly and is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License.
20 September 2005
Written by
Yours Truly (

)
Published on September 20th, 2005 @ 02:52:13 pm, using 220 words, 16548 views
In b2evolution 0.9.x automatically updating the antispam database involves the creation of a local file which will process the new entries and add them to the database. First, create a file in your b2evolution blog's /admin/ folder (in this example we name the file b2antispam_poll.php) and paste the following code into it:
<?php
require_once( dirname(__FILE__) . '/../conf/_config.php' );
$login_required = false;
require_once( dirname(__FILE__) . "/$admin_dirout/$core_subdir/_main.php" );
require_once (dirname(__FILE__).'/'.$admin_dirout.'/'.$core_subdir.'/_functions_antispam.php');
b2evonet_poll_abuse();
?>
Then, create the following crontab:
0 */6 * * * /path/to/php /path/to/blog/admin/b2antispam_poll.php
When CRON executes the b2antispam_poll.php file, the central antispam database is polled for new entries which are then entered into the local antispam database. Essentially, this process automates the task of updating the antispam list, eliminating the need for an administrator to manually keep the local antispam blacklist up to date.
(The above CRON syntax specifies that CRON will execute the b2antispam_poll.php file at the top of the hour, every six hours. Read this page for additional information on CRONtab syntax.)
Contemporaneous Auditory Narcotics:
or, What my speakers are currently pumping...
Quannum - I Changed My Mind
15 September 2005
Written by
Yours Truly (

)
Published on September 15th, 2005 @ 09:57:06 pm, using 123 words, 42132 views
The following block of PHP code will insert a blogroll or linkblog into the sidebar of your b2evolution 0.9.x blog. A blogroll is an aggregatated listing of external links which are stored, typically, on a dedicated 'linkblog' blog on a b2evolution system, and displayed as a list in the sidebar of other blogs on the same system.
<!-- ============== LINKBLOG ============= -->
<!-- =========== START SIDEITEM 7 ============ -->
<div class="bSideItem">
<!-- <h3><?php echo T_('Linkblog') ?></h3>-->
<?php require( dirname(__FILE__).'/_linkblog.php' ); // LINKBLOG INCLUDED HERE ?>
</div>
<!-- ============ END SIDEITEM 7 ============= -->
Contemporaneous Auditory Narcotics:
or, What my speakers are currently pumping...
Orbital - In Sides (U.S. Bonus Disc, Second Version)
11 September 2005
Written by
Yours Truly (

)
Published on September 11th, 2005 @ 06:33:12 pm, using 167 words, 32420 views
This block of PHP code shows the original 'smallhead' div in a typical b2evo 0.9.x blog skin. It displays the categories, author, post-time, and wordcount of each post. This code is located in the /skins/skinname/_main.php file of a typical b2evo skin, and is shown here for reference purposes in case changes are made which break something in the template:
<div class="bSmallHead">
<?php
$Item->issue_time();
echo ' | ', T_('Categories'), ': ';
$Item->categories();
?>
<br />
Posted by: <a href="<?php $Blog->disp( 'blogurl', 'raw' ) ?>?author=<?php the_author_ID() ?>" title="<?php echo T_('Browse all posts by this author') ?>"><?php $Item->Author->prefered_name() ?></a> |
<?php
$Item->wordcount();
echo ' ', T_('words');
?>
</div>
Contemporaneous Auditory Narcotics:
or, What my speakers are currently pumping...
Hallucinogen - Promotheus Process EP
10 September 2005
Written by
Yours Truly (

)
Published on September 10th, 2005 @ 07:23:45 pm, using 1758 words, 13946 views
This PHP hack for b2evo skins gives the ability to designate a particular post in each blog on a b2evolution system as a "sticky post" (i.e. that post will always appear at the top of the blog, and will not be listed chronologically). This is useful for creating a post which describes the contents of the blog or category, or which contains some other information which would be useful to have shown always on the entry page to a specific b2evo blog.
First, modify your "blogs" table so you can assign a post ID as 'sticky' for each blog. You will be able to set this in the b2evolution back office later. Assigning a value of 0 (zero) will mean no sticky post. I altered the b2evo blogs table via phpMyAdmin with the following mySQL command:
ALTER TABLE `evo_blogs` ADD `blog_stickypost_ID` INT( 10 ) DEFAULT '0' NOT NULL
Read the full text of this post...
Written by
Yours Truly (

)
Published on September 10th, 2005 @ 06:41:28 pm, using 539 words, 16477 views
This hack allows you to avoid the annoyingness of exiting to the first blog/stub after creating or editing a post in a sub-blog. In short, it saves a mouse-click and a little confusion... This hack for the b2evolution 0.9.x admin interface only works for people who use stubfiles to access their b2evo blogs, and who have correctly configured their stubfiles in their server's .htaccess file.
In /admin/_menutop.php find:
<div id="headfunctions">
<?php echo T_('Style:') ?>
<a href="#" onclick="setActiveStyleSheet('Variation'); return false;" title="Variation (Default)">V</a>·<a href="#" onclick="setActiveStyleSheet('Desert'); return false;" title="Desert">D</a>·<a href="#" onclick="setActiveStyleSheet('Legacy'); return false;" title="Legacy">L</a><?php if( is_file( dirname(__FILE__).'/custom.css' ) ) { ?>·<a href="#" onclick="setActiveStyleSheet('Custom'); return false;" title="Custom">C</a><?php } ?>
•
<a href="<?php echo $htsrv_url ?>/login.php?action=logout"><?php echo T_('Logout') ?></a>
•
<a href="<?php echo $baseurl ?>"><?php echo T_('Exit to blogs') ?> <img src="img/close.gif" width="14" height="14" class="top" alt="" title="<?php echo T_('Exit to blogs') ?>" /></a><br />
</div>
and change it to:
Read the full text of this post...