Hello,
I suggest a piece of code I created to implement article browsing by sections (if used) for example see
http://bibliolinux.cilea.it:7000/demo-ojs/search.php:
*********************
include/function.inc.php
*********************
add
//return if are more section available for view in index
function sectionAvailable(){
global $db;
$sql = "SELECT nSectionID FROM tblsections WHERE bMetaIndex = '1'";
$results = $db->query($sql);
if ($db->num_rows($results)) return true;
else return false;
}
***********
search.php
***********
add to line 52:
case "sectionIndex":
sectionIndex($HTTP_GET_VARS['secID']);
break;
add to line 590:
// show section index
// shows all paper by sections set to display in index
function sectionIndex($secID = 0) {
global $db,$bHTML,$bPDF,$bPostScript;
include("include/header.php");
?>
<span class="title"><b><?php echo _tr('SECTION_INDEX')?></b></span><br />
<ul>
<li><a href="search.php?op=index"><b><?php echo _tr('AUTHOR_INDEX') ?></b></a></li>
<?php if ($secID) {?><li><a href="search.php?op=sectionIndex"><b><?php echo _tr('SECTION_INDEX') ?></b></a></li><?php }?>
</ul>
<br />
<?php
if ($secID == 0) $sql = "SELECT nSectionID, chTitle, chIntro FROM tblsections WHERE bMetaIndex = '1'ORDER by nRank";
else $sql = "SELECT nSectionID, chTitle, chIntro, bContentsLinkPage FROM tblsections WHERE bMetaIndex = '1' AND nSectionID = '$secID' ORDER by nRank";
$sections = $db->query($sql);
for ($i = 0; $i < $db->num_rows($sections);$i++){
$section = $db->assoc_array($sections,$i);
?>
<span class="subtitle">
<?php
if (!$secID) { ?>
<a href="search.php?op=sectionIndex&secID=<?php echo $section['nSectionID']?>">
<b><?php echo $section['chTitle']?></b></a>
<?php }
else echo "<b>".$section['chTitle']."</b>"?>
</span><br />
<?php
if (!$section['chIntro']) echo $section['chIntro']."</ br>\n";
if ($secID) {?>
<span class="subtitle"><?php
$sql = "SELECT nArticleID, chMetaTitle, nIssueID, nVolume, nNumber, nYear,
a.dtDatePublished,dtDateHTMLGalleyCreated,dtDatePDFGalleyCreated,
dtDatePostScriptGalleyCreated,fkFilePDFID,fkFilePostScriptID,chHTML,
fkPublishStatusID
FROM tblarticles AS a, tblissues AS i
WHERE a.fkSectionID = '$secID' AND fkIssueID = nIssueID
AND a.bPublished = '1'
ORDER BY nYear DESC , nVolume DESC , nNumber DESC";
$results = $db->query($sql);
$numresults = $db->num_rows($results);
echo "<ul>\n";
for ($j = 0; $j < $numresults;$j++){
$result = $db->assoc_array($results,$j);
$year = date("Y", strtotime($result[dtDatePublished]));
$bContentsLinkPage = $section[bContentsLinkPage];
$dtDateHTMLGalleyCreated = $result[dtDateHTMLGalleyCreated];
$dtDatePDFGalleyCreated = $result[dtDatePDFGalleyCreated];
$dtDatePostScriptGalleyCreated = $result[dtDatePostScriptGalleyCreated];
$fkFilePDFID = $result[fkFilePDFID];
$fkFilePostScriptID = $result[fkFilePostScriptID];
$chHTML = $result[chHTML];
show_record($result[chMetaTitle], $nArticleID,
$result[nIssueID],$result[nNumber],$result[nVolume],$year,$section[chTitle],
$fkFilePDFID,$fkFilePostScriptID,$dtDateHTMLGalleyCreated,
$dtDatePDFGalleyCreated,$dtDatePostScriptGalleyCreated,
$bHTML,$bPDF,$bPostScript,$section[bContentsLinkPage],$result[fkPublishStatusID] != 2,"browsing");
}
echo "</ul>\n";
}
}
}
NOTE: this function require the architecture solution for display record that I have posted today.
If you want use my solution see:
http://www.aepic.it/docs/ojs/function.inc.php.txt
http://www.aepic.it/docs/ojs/search.php.txt
http://www.aepic.it/docs/ojs/viewissue.php.txt