Jump to content


Photo

Help!


  • Please log in to reply
7 replies to this topic

#1 NewGenerationTB

NewGenerationTB
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 12 April 2006 - 09:37 AM

Here is my question. I am running this code on my server. It say there is a syntax error in here. The code is

/*
5 public $content;
6 public $title = 'Cholsum.Com';
7 public $keywords = 'Hello World';
8 public $buttons = array( 'Home' => 'home.php',
'Forum' => 'forum.php',
'Index' => 'index.php',
'Menu' => 'menu.php',
'Contact' => 'contact.php',
*/

The error produced is : Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\domains\cholsum.com\wwwroot\page.inc on line 5

#2 SomeGuy1337

SomeGuy1337
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 12 April 2006 - 09:50 AM

hey

your missing the closing ) braket for you array

public $buttons = array( 'Home' => 'home.php',
'Forum' => 'forum.php',
'Index' => 'index.php',
'Menu' => 'menu.php',
'Contact' => 'contact.php',

to

public $buttons = array( 'Home' => 'home.php',
'Forum' => 'forum.php',
'Index' => 'index.php',
'Menu' => 'menu.php',
'Contact' => 'contact.php');

#3 bonaparte

bonaparte
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts
  • Location#172, I Floor, 'Hamsashree', Defence Colony, Sahakaranagar, Bangalore, India

Posted 12 April 2006 - 09:51 AM

[!--quoteo(post=363948:date=Apr 12 2006, 04:37 AM:name=NewGenerationTB)--][div class=\'quotetop\']QUOTE(NewGenerationTB @ Apr 12 2006, 04:37 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Here is my question. I am running this code on my server. It say there is a syntax error in here. The code is

/*
5 public $content;
6 public $title = 'Cholsum.Com';
7 public $keywords = 'Hello World';
8 public $buttons = array( 'Home' => 'home.php',
'Forum' => 'forum.php',
'Index' => 'index.php',
'Menu' => 'menu.php',
'Contact' => 'contact.php',
*/

The error produced is : Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\domains\cholsum.com\wwwroot\page.inc on line 5
[/quote]


Check the PHP version on your server. Public, private and protected properties were added in PHP 5. Previous versions of PHP will throw an error.

#4 NewGenerationTB

NewGenerationTB
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 12 April 2006 - 06:52 PM

[!--quoteo(post=363958:date=Apr 12 2006, 05:51 AM:name=bonaparte)--][div class=\'quotetop\']QUOTE(bonaparte @ Apr 12 2006, 05:51 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Check the PHP version on your server. Public, private and protected properties were added in PHP 5. Previous versions of PHP will throw an error.
[/quote]
Thanks everyone. The problem is still not solved. and the problem is with public $content; because it is the line 5 in my page.inc.

Please tell me the bug if you can think of any solutions, will be very appreciative.

Thanks everyone for trying to help me out!

NG

#5 NewGenerationTB

NewGenerationTB
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 12 April 2006 - 07:04 PM

[!--quoteo(post=363958:date=Apr 12 2006, 05:51 AM:name=bonaparte)--][div class=\'quotetop\']QUOTE(bonaparte @ Apr 12 2006, 05:51 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Check the PHP version on your server. Public, private and protected properties were added in PHP 5. Previous versions of PHP will throw an error.
[/quote]
Thanks everyone. The problem is still not solved. and the problem is with public $content; because it is the line 5 in my page.inc.

The server runs php version 4.4.1. I think that is the reason. Can anyone suggest solution for it? Thanks a lot!

Thanks everyone for trying to help me out!

NG

#6 chriscloyd

chriscloyd
  • Members
  • PipPipPip
  • Advanced Member
  • 489 posts
  • LocationArizona

Posted 12 April 2006 - 07:41 PM

whats content supposed to =?
44 bugs in my java code
44 bugs in my java code
Fix 1 bug, and complie again
122 bugs in my java code

#7 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 12 April 2006 - 07:52 PM

What is before line 5. Post the whole inculde file. PHP sometime prints the line where it gives up on trying to figure out what you meant, not the line where the error really occured.

Ken

#8 NewGenerationTB

NewGenerationTB
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 13 April 2006 - 12:50 AM

[!--quoteo(post=364175:date=Apr 12 2006, 03:52 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Apr 12 2006, 03:52 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
What is before line 5. Post the whole inculde file. PHP sometime prints the line where it gives up on trying to figure out what you meant, not the line where the error really occured.

Ken
[/quote]

following is the home.php:
----------------------------
/*
<?php
include('header.inc');
require ('page.inc');

$homepage = new Page();

$homepage->content = '<p><marquee behavior = "alternate">Welcome to Cholsum</marquee></p>
<!--side menu -->
<table width="100%" bgcolor="green" cellpadding="4" cellspacing="4" border="0">
<tr >
<td width="25%">
<img src="logo.gif" alt="" height=20 width=20> <span class="menu">Home</span>
</td>
<td rowspan="4">
<font color="Green"> Hello World!<br>
We provide you with the latest and most reliable news, stay tuned!
We provide you with the latest and most reliable news, stay tuned!
We provide you with the latest and most reliable news, stay tuned!
We provide you with the latest and most reliable news, stay tuned!
We provide you with the latest and most reliable news, stay tuned!
We provide you with the latest and most reliable news, stay tuned!
We provide you with the latest and most reliable news, stay tuned!
</font>
</td>
</tr>
<tr>
<td width="25%">
<img src="side - logo.gif" alt="" height=20 width=20> <span class="menu">Contact</span>
</td>
</tr>
<tr>
<td width="25%">
<img src="side-logo.gif" alt="" height=20 width=20> <span class="menu">Services</span>
</td>
</tr>
<tr>
<td width="25%">
<img src="side-logo.gif" alt="" height=20 width=20> <span class="menu">Site Map</span>
</td>
</tr>
<tr>
<td width="25%">
<img src="side-logo.gif" alt="" height=20 width=20> <span class="menu">News</span>
</td>
</tr>
<tr>
<td width="25%">
<img src="side-logo.gif" alt="" height=20 width=20> <span class="menu">Forum</span>
</td>
</tr>
<tr>
<td width="25%">
<img src="side-logo.gif" alt="" height=20 width=20> <span class="menu">Guess Book</span>
</td>
</tr>
<tr>
<td width="25%">
<img src="side-logo.gif" alt="" height=20 width=20> <span class="menu">Chat Room</span>
</td>
<tr>
<td width="25%">
<img src="side-logo.gif" alt="" height=20 width=20> <span class="menu">Tibet</span>
</td>
</tr>
</tr>
</table>';
$homepage->Display();
?>
*/

Follwoing is the page.inc
-----------------------------
/*
<?php
class Page
{
// class Page's attributes
public $content;
public $title = 'Cholsum.Com';
public $keywords = 'any words goes here to search';
public $buttons = array( 'Home' => 'home.php',
'Forum' => 'forum.php',
'Services' => 'services.php',
'Site Map' => 'map.php',
'Contact' => 'contact.php',
);

// class Page's operations
public function __set($name, $value)
{
$this->$name = $value;
}

public function Display()
{
echo "<html>\n<head>\n";
$this -> DisplayTitle();
$this -> DisplayKeywords();
$this -> DisplayStyles();
echo "</head>\n<body>\n";
$this -> DisplayHeader();
$this -> DisplayMenu($this->buttons);
echo $this->content;
$this -> DisplayFooter();
echo "</body>\n</html>\n";
}

public function DisplayTitle()
{
echo '<title> '.$this->title.' </title>';
}

public function DisplayKeywords()
{
echo "<meta name=\"keywords\" content=\"$this->keywords\" />";
}

public function DisplayStyles()
{
?>
<style>
h1 {color:white; font-size:24pt; text-align:center;
font-family:arial,sans-serif}
.menu {color:white; font-size:12pt; text-align:center;
font-family:arial,sans-serif; font-weight:bold}
td {background:black}
p {color:black; font-size:12pt; text-align:justify;
font-family:arial,sans-serif}
p.foot {color:white; font-size:9pt; text-align:center;
font-family:arial,sans-serif; font-weight:bold}
a:link,a:visited,a:active {color:white}
</style>
<?php
}

public function DisplayHeader()
{
?>
<table width="100%" cellpadding ="12" cellspacing ="0" border ="0">
<tr bgcolor ="black">
<td align ="left"><img src = "logo.gif" /></td>
<td>
<h1>Cholsum Online</h1>
</td>
<td align ="right"><img src = "logo.gif" /></td>
</tr>
</table>
<?php
}

public function DisplayMenu($buttons)
{
echo "<table width='100%' bgcolor='white' cellpadding='4'
cellspacing='4'\n";
echo " <tr>\n";

//calculate button size
$width = 100/count($buttons);

while (list($name, $url) = each($buttons))
{
$this -> DisplayButton($width, $name, $url, !$this->IsURLCurrentPage($url));
}
echo " </tr>\n";
echo "</table>\n";
}

public function IsURLCurrentPage($url)
{
if(strpos($_SERVER['PHP_SELF'], $url )==false)
{
return false;
}
else
{
return true;
}
}

public function DisplayButton($width, $name, $url, $active = true)
{
if ($active)
{
echo "<td width ='$width%'>
<a href ='$url'>
<img src ='logo.gif' alt ='$name' border ='0' /></a>
<a href ='$url'><span class='menu'>$name</span></a></td>";
}
else
{
echo "<td width ='$width%'>
<img src ='logo.gif'>
<span class='menu'>$name</span></td>";
}
}

public function DisplayFooter()
{
?>
<table width = "100%" bgcolor ="black" cellpadding ="12" border ="0">
<tr>
<td>
<p class="foot">Hello</p>
<p class="foot">Hello</p>
</td>
</tr>
</table>
<?php
}
}
?>

*/





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users