LoginRegister

Home :: Contributed Projects :: NexPro Theme

Contents
7 Contributed Projects

Functional Overview

Click for Larger View The nexPro theme is the same theme that comes bundled with nexPro. Its smooth blue look and collapse animations are sure to please the eye. This theme uses the Yahoo User Interface (YUI) to animate the collapse of any individual block or the all of the left blocks completely. Click the image on the left for a better view.

Return to Top

Installation Guide

In order to install the nexPro Theme on Geeklog, choose a archive format (ZIP or TAR.GZ) and obtain your copy of the nexPro theme from https://www.nextide.ca/nexfile/index.php?cid=6. Extract the tarball/zip archive to your layout directory, I.e. [geeklog]/public_html/layout.

That's it for all the new files for your nexPro theme! Now follow the instructions in the following section (7.1.2.1) to add required code to lib-custom.php.

Return to Top

Required Code

To complete the installation of the nexpro theme, there is some code that you will have to add to [geeklog_dir]/system/lib-custom.php.

Add this inside the function CUSTOM_templateSetVars:

global $_USER, $_CONF; //add to top of the function
 
//add this to the end of the function
if ($templatename == 'header') {
    nexpro_theme_required_code(&$template);
}

Add this code to the end of lib-custom.php:

function nexpro_theme_required_code(&$template) {
    global $_CONF;
 
    if ($_COOKIE['leftblocksmode'] == 'none') {
        $template->set_var( 'showhide', '<img src="'.$_CONF['layout_url'].'/images/showleftblocks.gif"
            onClick="toggleleftblocks(this);" ALT="Click to show Left Block" TITLE="Click to show Left Blocks" border="0">' );
    } else {
        $template->set_var( 'showhide', '<img src="'.$_CONF['layout_url'].'/images/hideleftblocks.gif"
            onClick="toggleleftblocks(this);" ALT="Click to hide Left Block" TITLE="Click to hide Left Blocks" border="0">' );
    }
    $template->set_var( 'leftblockmode', $_COOKIE['leftblocksmode']);
 
    if (!isset($CONF_NEXMENU)) $template->set_var('nexmenu','');
 
    if (file_exists("{$_CONF['path_layout']}/header.js")) {
        $code = '<script type="text/javascript">' . LB;
        $code .= '  var layout_url = "'. $_CONF['layout_url'] .'";' . LB;
        $code .= '</script>' .LB;
        $code .=  '<script type="text/javascript" src="'.$_CONF['layout_url'] .'/header.js"></script>';
    }             
 
    $code .= "\n\n<!-- Load Yahoo UI Javascript Libraries -->\n";
    $code .= '<script type="text/javascript" src="' . $_CONF['layout_url'] . '/javascript/yui/yahoo-min.js"></script>' . LB;
    $code .= '<script type="text/javascript" src="' . $_CONF['layout_url'] . '/javascript/yui/dom-min.js"></script>' . LB;
    $code .= '<script type="text/javascript" src="' . $_CONF['layout_url'] . '/javascript/yui/event-min.js"></script>' . LB;
    $code .= '<script type="text/javascript" src="' . $_CONF['layout_url'] . '/javascript/yui/animation-min.js"></script>' . LB;
    $code .= "<!-- End of Yahoo UI libraries -->\n";
 
    $template->set_var('header_javascript',$code);
}

Return to Top

Important Note

If you are running Geeklog version 1.4.x or lower, you will need to add code to your lib-common.php file. This is because there is a brand new feature coming out with Geeklog 1.5 which adds the ability to reference the different blocks individually with JavaScript.

To add this, locate the lib-common.php file, which is located in the public_html directory of your Geeklog instance, and open it in your favourite text editor. Around line 1369, you will find the following:

function COM_startBlock( $title='', $helpfile='', $template='blockheader.thtml' )
{
    global $_CONF, $LANG01, $_IMAGE_TYPE;
 
    $block = new Template( $_CONF['path_layout'] );
    $block->set_file( 'block', $template );
 
    $block->set_var( 'site_url', $_CONF['site_url'] );
    $block->set_var( 'layout_url', $_CONF['layout_url'] );
    $block->set_var( 'block_title', stripslashes( $title ));

This is the beginning of the COM_startBlock function. At that part of the function, you need to add some code.

I.e. just after this line …

$block->set_var( 'block_title', stripslashes( $title ));

… you need to add the following code:

// Set a blockid
if (!isset($GLOBALS['siteblocks'])) $GLOBALS['siteblocks'] = array();
$blockid = stripslashes ($title);
$blockid = strtr($blockid, "!@#$%^&*()'\"\\/?~`.,;: ", "________________________");
// Check if there is already a block of the same name
if (in_array($blockid,$GLOBALS['siteblocks'])) {
    // Now, in the unlikely chance there are multiple matching blocks
    for ($i=2; $i <= 5; $i++) {   // there can't be more then 5 blocks of the same name
        $nblockid = "{$blockid}{$i}";
        if (!in_array($nblockid,$GLOBALS['siteblocks'])) {
            $blockid = $nblockid;
            $GLOBALS['siteblocks'][] = $blockid;
            break;
        }
    }
} else {
    $GLOBALS['siteblocks'][] = $blockid;
}
$block->set_var( 'blockid', $blockid);

And that's it! Once this code is in place, you will have collapsible blocks on your Geeklog site.

Return to Top

nexpro_theme.txt · Last modified: 2007/11/05 09:05 by eric
Back to top