I got a list of articles in the banner... here is what I did:
<?php $secid = pnVarCleanFromInput
('secid');
if ( $secid ) { list($dbconn) = pnDBGetConn
();
$pntable = pnDBGetTables
();
$currentlang = pnUserGetLang
();
if (pnConfigGetVar
('multilingual') ==
1) { $column = &
$pntable['seccont_column'];
$querylang =
"AND ($column[slanguage]='$currentlang' OR $column[slanguage]='')";
/* the OR is needed to display stories who are posted to ALL languages */ } else { $querylang =
"";
} $column = &
$pntable['sections_column'];
$result =
$dbconn->
Execute("SELECT $column[secname]
FROM $pntable[sections]
WHERE $column[secid]=".pnVarPrepForStore
($secid).
"");
list($secname) =
$result->
fields;
$result->
Close();
if (!pnSecAuthAction
(0,
'Sections::Section',
"$secname::$secid", ACCESS_READ
)) { echo _SECTIONSARTICLENOAUTH;
return;
} $column = &
$pntable['seccont_column'];
$result =
$dbconn->
Execute("SELECT $column[artid], $column[secid], $column[title],
$column[content], $column[counter]
FROM $pntable[seccont]
WHERE $column[secid]=".pnVarPrepForStore
($secid).
" $querylang");
$column = &
$pntable['sections_column'];
$result2 =
$dbconn->
Execute("SELECT $column[image]
FROM $pntable[sections]
WHERE $column[secid]=".pnVarPrepForStore
($secid).
"");
list($image) =
$result2->
fields;
if ( ($image ==
"") or
($image ==
"none") ) { $image =
"transparent.gif";
} while(list($artid,
$secid,
$title,
$content,
$counter) =
$result->
fields) { $result->
MoveNext();
if (pnSecAuthAction
(0,
'Sections::Article',
"$title:$secname:$artid", ACCESS_READ
) &&
$secname !=
$title ) { echo " <a class=\"sublink\" href=\"modules.php?op=modload&name=".
$GLOBALS['name'].
"&file=index&req=viewarticle&artid=$artid&page=1&secid=$secid\">\n" .
" ".pnVarPrepForDisplay
($title).
"\n</a>\n" .
"   \n" ;
} } $result->
Close();
}?>
Now the only catch is that you have to put "&secid=$secid" at the end of all the links to the articles... so the original code for the section links above needs to be altered. Also you gotta hack modules/Sections/index.php to make it work there too.
I also altered my original section buttons code so that if there is an article with the same name as the section it will link to that instead of the article listing:
<?php list($dbconn) = pnDBGetConn
();
$pntable = pnDBGetTables
();
if (!pnSecAuthAction
(0,
'Sections::Section',
'::', ACCESS_OVERVIEW
)) { echo _SECTIONSNOAUTH;
return;
} $column = &
$pntable['sections_column'];
$result =
$dbconn->
Execute("SELECT $column[secid], $column[secname], $column[image]
FROM $pntable[sections] ORDER BY $column[secname]");
$sitename = pnConfigGetVar
('sitename');
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">\n<tr>\n";
$count =
0;
while(list($secid,
$secname,
$image) =
$result->
fields) { $result->
MoveNext() ;
// if we can't find an article with the same name as the section // then we should list the articles $sectionlink =
"<a class=\"button\" href=\"modules.php?op=modload&name=Sections&file=index&req=listarticles&secid=$secid\">" ;
// check to make sure we are allowed to access the articles if (pnSecAuthAction
(0,
'Sections::Section',
"$secname::$secid", ACCESS_READ
)) { // some language stuff $currentlang = pnUserGetLang
();
if (pnConfigGetVar
('multilingual') ==
1) { $column = &
$pntable['seccont_column'];
$querylang =
"AND ($column[slanguage]='$currentlang' OR $column[slanguage]='')";
/* the OR is needed to display stories who are posted to ALL languages */ } else { $querylang =
"";
} $column = &
$pntable['sections_column'];
$articleresult =
$dbconn->
Execute("SELECT $column[secname]
FROM $pntable[sections]
WHERE $column[secid]=".pnVarPrepForStore
($secid).
"");
list($secname) =
$articleresult->
fields;
$articleresult->
Close();
$column = &
$pntable['seccont_column'];
$articleresult =
$dbconn->
Execute("SELECT $column[artid], $column[secid], $column[title],
$column[content], $column[counter]
FROM $pntable[seccont]
WHERE $column[secid]=".pnVarPrepForStore
($secid).
" $querylang");
$column = &
$pntable['sections_column'];
while(list($artid,
$secid,
$title,
$content,
$counter) =
$articleresult->
fields) { $articleresult->
MoveNext() ;
if (pnSecAuthAction
(0,
'Sections::Article',
"$title:$secname:$artid", ACCESS_READ
) &&
$secname ==
$title ) { // found it! set the section link to the article $sectionlink =
"<a class=\"button\" href=\"modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=$artid&page=1&secid=$secid\">" ;
break;
} } // end while(list($artid, $secid, $title $content, $counter) = $articleresult->fields ... $articleresult->
Close();
} // end if (pnSecAuthAction(0, 'Sections::Section', "$secname::$secid", ACCESS_READ)) echo " <td>\n" .
" <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n" .
" <tr>\n" .
" <td>\n" .
" $pill_left\n" .
" </td>\n" .
" <td style=\"$pill_middle\" align=\"center\">\n" .
" $sectionlink\n" .
" $secname\n" .
" </a>\n" .
" </td>\n" .
" <td>\n" .
" $pill_right\n" .
" </td>\n" .
" </tr>\n</table>\n" .
" </td>\n" ;
$count++;
} // end while(list($secid, $secname, $image) = $result->fields) $result->
Close();
echo "</tr>\n</table>";
?>
I didn't bother taking out my site specific code (the button images).
Of course if anyone sees a problem in my code let me know, okay?
Peace out