Pntitle is a great little addition but I have been unable to get it work with books at all with:
Code
function books_title()
{
$bkid = pnVarCleanFromInput('bkid');
$catid = pnVarCleanFromInput('cid');
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if ($catid) {
$result = $dbconn->Execute("SELECT title
FROM $pntable[books_categories]
WHERE cid ='" . (int)pnVarPrepForStore($catid) . "'");
if ($dbconn->ErrorNo() != 0) {
return false;
}
list($title) = $result->fields;
$result->Close();
return pnConfigGetVar('sitename') . ' :: '.pnVarPrepForDisplay($title);
}
if ($bkid) {
$result = $dbconn->Execute("SELECT title
FROM $pntable[books_books]
WHERE bkid ='" . (int)pnVarPrepForStore($bkid) . "'");
if ($dbconn->ErrorNo() != 0) {
return false;
}
list($title) = $result->fields;
$result->Close();
return pnConfigGetVar('sitename') . ' :: '.pnVarPrepForDisplay($title);
}
return pnConfigGetVar('sitename') . ' :: '. _BOOKS;
}
{
$bkid = pnVarCleanFromInput('bkid');
$catid = pnVarCleanFromInput('cid');
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
if ($catid) {
$result = $dbconn->Execute("SELECT title
FROM $pntable[books_categories]
WHERE cid ='" . (int)pnVarPrepForStore($catid) . "'");
if ($dbconn->ErrorNo() != 0) {
return false;
}
list($title) = $result->fields;
$result->Close();
return pnConfigGetVar('sitename') . ' :: '.pnVarPrepForDisplay($title);
}
if ($bkid) {
$result = $dbconn->Execute("SELECT title
FROM $pntable[books_books]
WHERE bkid ='" . (int)pnVarPrepForStore($bkid) . "'");
if ($dbconn->ErrorNo() != 0) {
return false;
}
list($title) = $result->fields;
$result->Close();
return pnConfigGetVar('sitename') . ' :: '.pnVarPrepForDisplay($title);
}
return pnConfigGetVar('sitename') . ' :: '. _BOOKS;
}
and for the encyclopedia I made a few changes to get it to work by adding 'PN' where needed (changed the cvs edition from sourceforge):
Code
function pnEncyclopedia_title()
{
$vid = pnVarCleanFromInput('vid');
$letter = pnVarCleanFromInput('letterget');
$id = pnVarCleanFromInput('id');
$term = pnVarCleanFromInput('term');
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
// default
$title = '';
if ($vid) {
$volumecolumn = $pntable[pnEncyclopedia_volumes_column];
$sql = "SELECT $volumecolumn[volume] FROM $pntable[pnEncyclopedia_volumes] WHERE $volumecolumn[vid] = '" . (int)pnVarPrepForStore($vid) . "'";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
return false;
}
list($volname) = $result->fields;
$result->Close();
$title .= ' - ' . $volname ;
}
if ($id) {
$encyclopediacolumn = $pntable['pnEncyclopedia_column'];
$sql = "SELECT $encyclopediacolumn[term] FROM $pntable[pnEncyclopedia] WHERE $encyclopediacolumn[id] = '" . (int)pnVarPrepForStore($id) . "'";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
return false;
}
list($term) = $result->fields;
$result->Close();
$title .= ' - ' . $term;
} else {
if ($term) { $title .= ' - ' . $term; }
if ($letter) { $title .= ' - ' . $letter; }
}
if ($title !='' ) {
return pnConfigGetVar('sitename') . ' :: '. $title;
} else {
return pnConfigGetVar('sitename') . ' :: Encyclopedia';
}
}
?>
{
$vid = pnVarCleanFromInput('vid');
$letter = pnVarCleanFromInput('letterget');
$id = pnVarCleanFromInput('id');
$term = pnVarCleanFromInput('term');
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
// default
$title = '';
if ($vid) {
$volumecolumn = $pntable[pnEncyclopedia_volumes_column];
$sql = "SELECT $volumecolumn[volume] FROM $pntable[pnEncyclopedia_volumes] WHERE $volumecolumn[vid] = '" . (int)pnVarPrepForStore($vid) . "'";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
return false;
}
list($volname) = $result->fields;
$result->Close();
$title .= ' - ' . $volname ;
}
if ($id) {
$encyclopediacolumn = $pntable['pnEncyclopedia_column'];
$sql = "SELECT $encyclopediacolumn[term] FROM $pntable[pnEncyclopedia] WHERE $encyclopediacolumn[id] = '" . (int)pnVarPrepForStore($id) . "'";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
return false;
}
list($term) = $result->fields;
$result->Close();
$title .= ' - ' . $term;
} else {
if ($term) { $title .= ' - ' . $term; }
if ($letter) { $title .= ' - ' . $letter; }
}
if ($title !='' ) {
return pnConfigGetVar('sitename') . ' :: '. $title;
} else {
return pnConfigGetVar('sitename') . ' :: Encyclopedia';
}
}
?>
Where am I going wrong on the books? The only title working is the 'books' title for the main page:
http://www.canadiandemocraticmovement.ca/books.html
None of the catagories work - and how to include the individual book title?
--
WIRE SERVICE
Free Press Releases
