// ================= T.J.Henry at businesswebs dot com =================
// Prepare a list of pages and those pages they link to.
// based on the function view_macro_linktab() as stolen from macros.php
//Put this kluge in .../parse/macros.php
function view_macro_sitemap()
{
global $pagestore, $LkTbl;
$lastpage = '';
$text = '';
// Use the "links" table as the datasource for the sitemap - order by 'page' to see structure
$q1 = $pagestore->dbh->query("SELECT page, link FROM $LkTbl ORDER BY page");
while(($result = $pagestore->dbh->result($q1)))
{
if($lastpage != $result[0])
{
if($lastpage != ''){
// $text = $text . "\n";
$text = $text . "</UL>"; // === TJH ===
}
// $text = $text . html_ref($result[0], $result[0]) . ' |'; // === TJH ===
$text = $text . html_ref($result[0], $result[0]) . '<br /><UL>';
$lastpage = $result[0];
}
// $text = $text . ' ' . html_ref($result[1], $result[1]); // === TJH ===
$text = $text . '<li type=circle>' . html_ref($result[1], $result[1])."</li> ";
}
$text .= '</ul>';
// return html_code($text); // === TJH === don't use html_code() taht func adds <pre> tags
return $text;
}
// The ===== common.php ======= file looks like kinda like this
// I wanted the sitemap to be in a right-hand-side column
// I added a col to the main layout table
<table>
<tr>
<td> All HEADER Stuff here </td>
<td rowspan=2 width="120" valign="top">
<table cellspacing="0" cellpadding="6" border="0">
<tr>
<td width="10" class="sitemap" style="sitemap">
<b>Sitemap:</b><br />
<?php print view_macro_sitemap(); /// Here is the sitemap !!! ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> MY MAIN PAGE CONTENT IS HERE </td>
</tr>
</table>
I found it easier to place the function view_macro_sitemap within common.php rather than into parse/macros.php - otherwise I got errors as view_macro_sitemap was not defined for some pages.
Paul M
I'm sorry if I'm just too dense to get this.
Do you add the lower part to your 'common.php' file?
I get where the top part goes.
Thanks!