<?php
/**
* Contains:
* function showHtmlHeader()
* function showHtmlFooter()
* function showPrintHeader()
* function showPrintFooter()
* function startHTML()
* function endHTML()
*
* @file global.php
* @author Jesper Rønn <hide@address.com>
* @author Tobias H. Michaelsen <hide@address.com>
* @date 1999-11-10
*
* @calledby index.php
* @calls include/menu.php
*
* $Id: global.php,v 1.24 2001/10/21 15:10:07 zaiborg Exp $
*/
if (DEBUG) { echo "<!-- Start of file: global -->\n"; }
function startHTML()
{
global $cfg, $design, $show, $site, $txt;
switch ($cfg['doctype']) {
case 'xhtml':
case 'xhtml1':
case 'xhtml1-strict':
echo '<?xml version="1.0" encoding="iso-8859-1"?>'."\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"';
echo ' "'.$site['basehref'].'DTD/xhtml1-strict.dtd">'."\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" ';
echo 'lang="'.$cfg['lang'].'" xml:lang="'.$cfg['lang'].'">'."\n";
break;
case 'html':
case 'html4':
case 'html4-strict':
default:
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"';
echo ' "http://www.w3.org/TR/html4/strict.dtd">'."\n";
echo '<html lang="'.$cfg['lang'].'">'."\n";
}
?>
<head>
<title><?php echo $txt['appTitle']; ?></title>
<meta name="KeyWords" content="<?php echo $txt['metaKeyWords']; ?>" />
<meta name="Author" content="PHP SiteBuilder" />
<?php
if (isset($design['style']))
echo ' <link rel="stylesheet" type="text/css" href="';
echo 'style/'.$design['style'].'.css';
# echo 'style/style.php?style='.$design['style'];
echo '" />'."\n";
?>
<base href="<?php echo $site['basehref']; ?>" />
<script type="text/javascript" src="include/form.js"></script>
</head>
<body lang="<?php echo $cfg['lang']; ?>">
<?php
return true;
}
function endHTML()
{
echo "\n</body>\n</html>\n";
return true;
}
/**
* Show the top of the page
*/
function showHtmlHeader()
{
global $cfg, $design, $show, $site, $txt;
startHTML();
?>
<table class="content">
<!-- Top starts here -->
<tr><td colspan="3" id="top" class="content">
<?php
echo '<div id="title">';
echo '<a href="'.$site['basehref'].'" title="'.$txt['appTitle'].'">';
if ($design['logoFile']) {
echo '<img src="'.$design['logoFile'].'" ';
echo 'height="'.$design['logoH'].'" width="'.$design['logoW'].'"';
echo 'border="0" alt="'.$txt['appTitle'].' Homepage">';
} else {
echo $txt['appTitle'];
}
echo '</a></div>'."\n";
echo ' <div id="date">';
if (file_exists($cfg['searchCodeFile']) && $show['searchField']) {
include $cfg['searchCodeFile'];
} else {
echo $cfg['dateString'];
}
echo '</div>'."\n";
?>
</td></tr>
<!-- Top ends here -->
<?php
if ($show['path'])
{
?>
<tr><td colspan="2" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td>
<?php include('path.php'); ?>
</td></tr></table></td></tr>
<?php
} /* End if ($show['path']) */
?>
<tr>
<td id="menu" class="content">
<!-- Left hand menu starts here -->
<?php
$menu = new XML_Menu($cfg['menuXMLFile']);
echo $menu->html;
$menu->free();
?>
<!-- Left hand menu ends here -->
</td>
<td id="article" class="content">
<!-- Start Main Content -->
<!-- Main content will be filled in here by the calling page... -->
<?php
} /* End function showHeader() */
/**
* Show everything following the main contents
*
*/
function showHtmlFooter()
{
global $cfg, $design, $show, $site, $txt;
?>
<!-- End Main Content -->
</td>
<td id="news" class="content">
<!-- Start Right Column Content -->
<?php
# 2000-10-08 JROE Question: How can we decide the order of the
# three colums below via the config-files??
// Latest news:
if ($show['numNews'] > 0) {
$moreLink = computeMoreLink('news', $txt['moreLink']);
if (!file_exists($cfg['newsXmlFile'])) {
$newsArray = getNewsArray($cfg['newsFile']);
if (is_string($newsArray)) {
// An error has occured, and $newsArray contains error-message!
echo $newsArray;
// continue with an empty array...
$newsArray = array();
}
createXMLNewsFile($cfg['newsXmlFile'], $txt['newsTitle'], $newsArray);
}
$newsBox = new XML_NewsBox($cfg['newsXmlFile'], $moreLink, $show['numNews']);
if (PEAR::isError($newsBox)) {
echo $newsBox->getMessage();
} else {
echo $newsBox->html;
}
}
// Latest on the WebBoard:
if ($show['numWebboardNews'] > 0) {
$moreLink = computeMoreLink('webboard', $txt['moreLink']);
if (!file_exists($cfg['debatXmlFile'])
or filemtime($cfg['debatFile']) > filemtime($cfg['debatXmlFile'])) {
$newsArray = getWebboardArray($cfg['debatFile'], $show['numWebboardNews']);
if (is_string($newsArray)) {
// An error has occured, and $newsArray contains error-message!
echo $newsArray;
// continue with an empty array...
$newsArray = array();
}
createXMLNewsFile($cfg['debatXmlFile'], $txt['debatTitle'], $newsArray);
}
$newsBox = new XML_NewsBox($cfg['debatXmlFile'], $moreLink, $show['numWebboardNews']);
if (PEAR::isError($newsBox)) {
echo $newsBox->getMessage();
} else {
echo $newsBox->html;
}
}
// Popular picks:
if ($show['numPop'] > 0) {
$moreLink = '';
if (!file_exists($cfg['popXmlFile'])) {
$newsArray = getNewsArray($cfg['popFile']);
if (is_string($newsArray)) {
// An error has occured, and $newsArray contains error-message!
echo $newsArray;
// continue with an empty array...
$newsArray = array();
}
createXMLNewsFile($cfg['popXmlFile'], $txt['popTitle'], $newsArray);
}
$newsBox = new XML_NewsBox($cfg['popXmlFile'], $moreLink, $show['numPop']);
if (PEAR::isError($newsBox)) {
echo $newsBox->getMessage();
} else {
echo $newsBox->html;
}
}
?>
<!-- End Right Column Content -->
</td>
</tr>
<!-- Start Copyright -->
<tr>
<td colspan="3" id="bottom" class="content">
<?php echo $txt['copyMessage']; ?>
</td>
</tr>
<!-- End Copyright -->
</table>
<?php
if ( $show['statFile'] )
{
include($cfg['statFile']);
}
endHTML();
} /* End function showFooter() */
/**
* View page for printing...
*/
function showPrintHeader() {
global $cfg, $design, $show, $site, $txt;
startHTML();
echo '<style type="text/css">body{background-color:white}</style>'."\n";
echo '<div id="article">'."\n";
echo '<div><span id="title">'.$txt['appTitle'].'</span>';
echo '<span id="date">'.$cfg['dateString'].'</span>'."\n";
echo '<div style="clear: both;"></div></div>'."\n";
echo '<hr /><br />';
}
function showPrintFooter() {
global $cfg, $design, $show, $site, $txt;
echo "\n<br />\n";
echo '<div id="bottom">'.$txt['copyMessage']."</div>\n";
echo '</div>'."\n";
endHTML();
}
if (DEBUG) { echo "<!-- End of file: global -->\n"; }
/* vim: set tabstop=4: */
?>