Location: PHPKode > projects > Books Module for PostNuke > html/Modules/books/pntitle.php
<?php
// File: $Id: pntitle.php,v 1.2 2005/03/22 18:35:17 jmvedrine Exp $
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
/**
 * PostNuke Title Hack
 * 
 * Show individual titles at your PostNuke pages. 
 * 
 * @package      TitleHack
 * @version      $Id: pntitle.php,v 1.2 2005/03/22 18:35:17 jmvedrine Exp $
 * @author       Joerg Napp <hide@address.com>
 * @link         http://lottasophie.sourceforge.net Official Support Site
 * @copyright    Copyright (C) 2003 Joerg Napp
 * @license      http://www.gnu.org/copyleft/gpl.html GNU General Public License
 */ 

 
/**
 * Return the title for the books Module
 * 
 * This function returns the meaningful title for the current page
 * 
 * @author       Jean-Michel VĂ©drine, http://www.vedrine.net
 * @version      $Revision: 1.2 $
 * @return       string   The title for the current page
 */
function books_title() 
{
    $bkid = pnVarCleanFromInput('bkid');
    $catid = pnVarCleanFromInput('cid');

    $dbconn =& pnDBGetConn(true);
    $pntable = pnDBGetTables();
	$bookprefix = pnConfigGetVar('prefix');
    
    if ($catid) {
        $sql = "SELECT title FROM {$bookprefix}_books_categories  WHERE cid = '" . pnVarPrepForStore($catid) . "'";
        $result = $dbconn->Execute($sql);
		if ($dbconn->ErrorNo() != 0) {
        	return false;
		}
        list($title) = $result->fields;
        $result->Close();
        return pnConfigGetVar('sitename') . ' :: '.pnVarPrepForDisplay($title);    
    }
         
    if ($bkid) {
        $sql = "SELECT title FROM {$bookprefix}_books_books WHERE bkid = '" . pnVarPrepForStore($bkid) . "'";
        $result = $dbconn->Execute($sql);
		if ($dbconn->ErrorNo() != 0) {
        	return false;
		}
        list($title) = $result->fields;
        $result->Close();
        $title = str_replace('&amp;', '&', pnVarPrepForDisplay($title));
        return pnConfigGetVar('sitename') . ' :: '. $title;
    }

    return pnConfigGetVar('sitename') . ' :: '. _BOOKS;

}
?>
Return current item: Books Module for PostNuke