the line where it says parent::config() , its giving me an error for that: Parse error: parse error, expecting T_OLD_FUNCTION' orT_FUNCTION' or T_VAR' or'}''
anyone know why its giving me that error and how i can fix that? here's the code
<?php
// global_application.php
/*---------------------------------------------------------
Debugging
---------------------------------------------------------*/
error_reporting(ER_ALL);
/*---------------------------------------------------------
Database class
- connection to database
- database info
---------------------------------------------------------*/
class Db
{
// attributes
var $server = "localhost";
var $database = "jameshu_gardengrove";
var $username = "jameshu_gardengr";
var $password = "spoonful247";
var $dbConnect;
var $dbSelect;
// operations
function connectDb()
{
// connect to server
$this->dbConnect = mysql_connect($this->server, $this->username, $this->password)
or die('Could not connect to server!');
// connect to database
$this->dbSelect = mysql_select_db($this->database, $this->dbConnect)
or die('Could not connect to database!');
}
}
/*---------------------------------------------------------
Config class
- generic
---------------------------------------------------------*/
class Config
{
var $wwwRoot;
var $dirRoot;
var $includesRoot;
var $imagesRoot;
// assigns config info
function config()
{
$this->wwwRoot = "/gardengrove/";
$this->dirRoot = "/home/user_name/public_html/";
$this->includesRoot = $this->dirRoot . "includes/";
$this->imagesRoot = $this->wwwRoot . "images/";
}
}
/*---------------------------------------------------------
Config object
---------------------------------------------------------*/
$cfg = new Generic;
/*---------------------------------------------------------
Page class
- displays dynamic and static pages
----------------------------------------------------------*/
class Page extends Config
{
// attributes
var $body;
var $title;
var $keywords = "Garden Grove band, band";
var $dbQuery;
var $dbResult;
var $dbResultNum;
var $newsUserId;
var $newsSubject;
var $newsNews;
var $newsTimestamp;
// pull config() from Config class
Config::config();
//operations
function setBody($newBody)
{
$this->body = $newBody;
}
function setTitle($newTitle)
{
$this->title = $newTitle;
}
function setKeywords($newKeywords)
{
$this->keywords = $newKeywords;
}
// display the page
function display()
{
echo "<html>
<head>";
$this->displayTitle();
$this->displayKeywords();
$this->displayIncludes();
echo "</head>
<body>";
$this->displayHeader();
$this->displaySectionImage();
echo "<td width=\"784\" height=\"400\"class=\"body\">";
echo $this->body;
echo "</td>
</tr>
</table>";
$this->displayFooter();
echo "</body>
</html>";
}
// display title
function displayTitle()
{
echo "<title>$this->title</title>";
}
// display meta keywords
function displayKeywords()
{
echo "<meta name=\"keywords\" content=\"$this->keywords\">";
}
// display includes
function displayIncludes()
{
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$this->includesRoot . gardengrove.css\">";
}
// display header
function displayHeader()
{
echo "<map name=\"logo\">
<area shape=\"rect\" coords=\"432,234,488,256\" href=\"/\">
<area shape=\"rect\" coords=\"490,227,549,254\" href=\"/band/\">
<area shape=\"rect\" coords=\"551,228,669,254\" href=\"/discography/\">
<area shape=\"rect\" coords=\"671,229,738,254\" href=\"/media/\">
<area shape=\"rect\" coords=\"740,227,795,254\" href=\"/links/\">
</map>
<table cellspacing=\"0\" cellpadding=\"0\" class=\"overall\" width=\"800\">
<tr>
<td colspan=\"2\"><img src=\"images/overall_logo.jpg\" width=\"800\" usemap=\"#logo\" border=\"0\"></td>
</tr>
<tr>";
}
// display the section image
function displaySectionImage()
{
echo "<td width=\"16\" class=\"bodyTitle\"><img src=\"$imagesRoot/body_$currentPage.gif\" width=\"15\" height=\"32\" class=\"body\"></td>";
}
// display the each imagemap sector for navigation
function displayNav($navName, $navUrl, $navCoord)
{
echo "<area shape=\"rect\" coords=\"$navCoord\" href=\"$navUrl\" alt=\"$navName\">";
}
// display footer
function displayFooter()
{
echo "<table cellspacing=\"0\" cellpadding=\"0\" class=\"footer\" width=\"800\">
<tr>
<td><img src=\"images/overall_footer.jpg\" width=\"800\" height=\"105\"></td>
</tr>
</table>
<table cellspacing=\"0\" cellpadding=\"0\" width=\"800\">
<tr>
<td class=\"copyright\">Copyright © 2004 Garden Grove. All rights reserved. <a href=\"$->dirRoot/contact/\" class=\"secondary\">Contact</a></td>
</tr>
</table>";
}
// specialty page functions
// display news
function displayNews()
{
$this->dbQuery = "SELECT * FROM news WHERE userid = '$this->newsUserId'
AND subject = '$this->newsSubject' AND news = '$this->newsNews'
AND timestamp = '$this->newsTimestamp'";
$this->dbResult = mysql_query($this->dbQuery);
$this->dbResultNum = mysql_num_rows($this->dbResult);
// will count how many rows in database and then
// loop display until there are no more to display
if ($this->dbResultNum)
{
echo "<span class=\"newsTitle\">$this->newsSubject</span>
<br /><span class=\"newsOrigin\">$this->newsUserId - $newsDate @ $newsTime</span>
<br /><br />$this->newsNews</td>";
}
}
}
?>
and also, when i try to create a new object from the class Page
$news = new Page extends Config();
it gives me an error that Cannot instantiate non-existent class: page, which is very strange. Thank you for your time!