Lol - I'd never thought of that, no they're not in an array:
index.php (calls the function):
<?php
// Include template file
include("style/pattemplate.php");
// Include the page files
include("includes/class.php");
// Process the news script
$tmprocess = new TopMenu;
$topmenu = $tmprocess->retrieve_topmenu("menua");
$nprocess = new News;
$body = $nprocess->retrieve_news("news");
// Initialize the template file and create the necessary object
$tmpl = new patTemplate();
// Set which directory contains the template file
$tmpl->setBasedir("style");
// Set the template file to be read
$tmpl->readTemplatesFromFile("template.html");
// Add the variables to the template
$tmpl->addVar("fateam.com","pagetitle","News");
$tmpl->addVar("fateam.com","topmenu",$topmenu);
$tmpl->addVar("fateam.com","title","News @ fateam.com <<-");
$tmpl->addVar("fateam.com","body",$body);
$tmpl->addVar("fateam.com","copyright","© fateam.com 2003 - <a href=\"http://www.fateam.com/legal.php\">Legal Info</a> | <a href=\"http://www.fateam.com/privacy.php\">Privacy Policy</a>");
// Parse and display the template
$tmpl->displayParsedTemplate("fateam.com");
?>
class.php (contains the function called):
<?
class Section
{
function call_dbfunction()
{
$this->dbfunction("localhost","root","");
}
function dbfunction($dbserv,$dbuser,$dbpass,$dbname)
{
$this->dbserv = $dbserv;
$this->dbuser = $dbuser;
$this->dbpass = $dbpass;
}
function dbquery($query)
{
$connection = mysql_connect($this->dbserv,$this->dbuser,$this->dbpass)
or die(mysql_error());
$ret = mysql_db_query("fateam",$query,$connection)
or die(mysql_error());
return $ret;
}
function retrieve_section($id)
{
if($id == "none")
{
$body = "No ID was provided for the page that you requested. Please try refreshing this page, if you continue to get this message please send an email to: <a href=\"mailto:admin@fateam.com\">admin@fateam.com</a>";
return $body;
}
else
{
$query = "SELECT title,body FROM sections WHERE id='$id'";
$result = $this->dbquery($query);
$rowcount = mysql_num_rows($result);
if($rowcount > 0)
{
$body = "";
While($array = mysql_fetch_array($result))
{
$body .= $array['body'];
return $body;
}
}
else
{
$body = "";
$body .= "Error! There was a problem finding the page you requested. Please refresh the page, if you continue to recieve this error then you should contact <a href=\"mailto:admin@fateam.com\">admin@fateam.com</a></td></tr>";
return $body;
$title = "Help";
return $title;
}
}
}
}
?>
Thanks in advance,
Chris