Location: PHPKode > scripts > BOOKS module for PostNuke > books-module-for-postnuke/includes/blocks/books.php
<?php // $Id: books.php,v 1.6 2002/01/28 16:33:41 micha Exp $
// ----------------------------------------------------------------------
// BOOKS module
// Copyright (C) 2001, 2002 by IB Rahn, http://www.ib-rahn.de
// Written by Michael Schatz, hide@address.com
// get the newest version at http://www.bauphysik.com
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------

$blocks_modules[books] = array(
    'title' => 'Books',
    'func_display' => 'blocks_book_block',
    'text_type' => 'Books',
    'text_type_long' => 'Books',
    'text_content' => 'Books',
    'support_nukecode' => false,
    'allow_create' => false,
    'allow_delete' => false,
    'form_url' => false,
    'form_content' => false,
    'form_refresh' => false,
    'show_preview' => true
);
function blocks_book_block($row) { /* ML added globals and querylang */
    global $prefix;
    $prefix = "nuke";
    $ModName = "Books";
    $result = mysql_query("select count(*) as count from $prefix"._books_books."");
    $numrows = mysql_result($result,0,"count");
    if ($numrows == 1) {
        $randombkid = 1;
    } else {
        srand((double)microtime()*1000000);
        $randombkid = rand(1,$numrows);
    }
    $boxstuff = "<font class=\"pn-normal\"><center>";
    $bkresult = mysql_query("select bkid, title, cover from $prefix"._books_books." where bkid = $randombkid");
    while(list($bkid, $bktitle, $cover)=mysql_fetch_row($bkresult)) {
        $bktitle = stripslashes($bktitle); 
        $transfertitle = ereg_replace (" ", "_", $bktitle);
        if ($cover > "!") { // there is more than a space
            $boxstuff .= "<a class=\"pn-menu\" href=\"modules.php?op=modload&amp;name=$ModName&amp;file=index&amp;bkid=$bkid&amp;ttitle=$transfertitle\"><img src=\"$cover\" border=\"0\" alt=\"\"></a><br>";
        } else {
            $boxstuf .= "<br>";
        }
        $boxstuff .= "<a class=\"pn-menu\" href=\"modules.php?op=modload&amp;name=$ModName&amp;file=index&amp;bkid=$bkid&amp;ttitle=$transfertitle\"><b>$bktitle</b></a><br>";
    }
    $boxstuff .= "</center></font>";
    $row[content] = $boxstuff;
    themesideblock($row);
}
?>
Return current item: BOOKS module for PostNuke