Hi guys,

I'm doing a mock-up of my page and here what's i got when uploaded it on hosting:

Parse error: parse error, expecting `')'' in /var/www/html/...services.php on line 6

Here's the code:

class ServicePage extends Page
{
var $row2buttons = array('Translation' = > 'translation.php',
"Travel" => "travel.php",
"Visa" => "visa.php"
);

the line 6 is that starts with "var"

thank you so much!

    May I please see the whole class file so I can see as it might be in a different spot as PHP is not good with exact error lines.

      <?
      require ("page.inc");

      class ServicePage extends Page
      {
      var $row2buttons = array('Translation' = > 'translation.php',
      "Travel" => "travel.php",
      "Visa" => "visa.php"
      );

      function Display()
      {
      echo "<html>\n<head>\n";
      $this -> DisplayTitle();
      $this -> DisplayKeywords();
      $this -> DisplayContentdescription();
      $this -> DisplayStyles();
      echo "</head>\n<body cellspacing=0 cellpadding=0 leftmargin=0 rightmargin=0 topmargin=0 marginheight=0 marginwidth=0>\n";
      $this -> DisplayHeader();
      $this -> DisplayMenu($this->buttons);
      $this ->DisplayMenu($this->row2buttons);
      echo $this->content;
      $this -> DisplayFooter();
      echo "</body>\n</html>\n";
      }
      }

      $services = new ServicesPage();
      $content = "<table background color=#ffffff border=0 cellspacing=20 cellpadding=20>
      <tr><td>
      <p>Our philosophy is to provide the best possible service for the lowest price.
      </p>/td></tr></table>";
      $services ->SetContent($content);
      $services ->Display();
      ?>

      This is Services Page which inherits from the Page class
      but overrides Display() to alter the output

        um............php is always perfect with exact error lines, even when you do including, as it will you give the line number of the included file. and seeing as he told us the line that was problematic, you could at least look at it.

        Now i have no idea waht is wrong, but try changing the quotes around a bit. or , im not shur, but i think the => assignment operator cannot be writen as = >. try this:

        class ServicePage extends Page
        {
        var $row2buttons = array("Translation" => "translation.php",
        "Travel" => "travel.php",
        "Visa" => "visa.php"
        );

          LOL sry to say but PHP is not perfect on exact error lines as I have a 131 line script and a error line of 90 was given to me but the actual error was 11 lines up on line79. So I jsut wanted to see the rest of the script that is all.

          However Taya you must be consistent on those quotes but that does not seem to be the error that was given.

            Do you want to have a look at the page.inc - included page?

              Not sure if it would be in the Page.inc but show us anyway as it could be in there but most likely it is somewhere around that line which is the .inc anyway lol so could be but not sure.

                <?
                class Page
                {

                // class Page's attributes
                var $content;
                var $title = "Hooray";
                var $keywords = "hooray,hooray siberia";
                var $contentdescription = "siberia";
                var $buttons = array( "Home" => "index.php",
                "Services" => "services.php",
                "Gallery" => "gallery.php",
                "FAQ" => "faq.php",
                "Contact" => "contact.php"
                );

                // class Page's operations

                function SetContent($newcontent)
                {
                $this->content = $newcontent;
                }

                function SetTitle($newtitle)
                {
                $this->title = $newtitle;
                }

                function SetKeywords($newkeywords)
                {
                $this->keywords = $newkeywords;
                }

                function SetContentdescription($newcontentdescrition)
                {
                $this->contentdescription = $newcontentdescription;
                }

                function SetButtons($newbuttons)
                {
                $this->buttons = $newbuttons;
                }

                function Display()
                {
                echo "<html>\n<head>\n";
                $this -> DisplayTitle();
                $this -> DisplayKeywords();
                $this -> DisplayContentdescription();
                $this -> DisplayStyles();
                echo "</head>\n<body cellspacing=0 cellpadding=0 leftmargin=0 rightmargin=0 topmargin=0 marginheight=0 marginwidth=0>\n";
                $this -> DisplayHeader();
                $this -> DisplayMenu($this->buttons);
                echo $this->content;
                $this -> DisplayFooter();
                echo "</body>\n</html>\n";
                }

                function DisplayTitle()
                {
                echo "<title> $this->title </title>";
                }

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

                function DisplayStyles()
                {
                ?>

                <style>

                .menu { font-family: Georgia, Times New Roman, Times, serif; 

                color:#ffffff; font-size:15px; text-decoration: none;}
                a.menu:hover { font-family: Georgia, Times New Roman, Times, serif;
                color:#ffffff; font-size:15px; text-decoration: underline;}

                p {color:333333; font-size:12pt; text-align:justify; 
                   font-family:arial,sans-serif;}
                p.foot {color:999999; font-size:8pt; text-align:center; 
                        font-family:Georgia, Times New Roman, Times, serif; font-weight:bold}
                a:link,a:visited,a:active {color:333333}

                </style>
                <?
                }

                function DisplayContentdescription()
                {
                echo "<META name=\"description\" content=\"$this->contentdescription\">";
                }

                function DisplayHeader()
                {
                ?>

                <table width="100%" cellpadding = 0 cellspacing =0 border = 0>
                <tr>
                <td><img src = "flowersheader.jpg" alt="Siberia" height="101" border="0"></td>

                </tr>
                </table>
                <?
                }

                function DisplayMenu($buttons)
                {
                echo "<table width = \"100%\" height=25px bgcolor = #9999cc 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";

                }

                function IsURLCurrentPage($url)
                {
                if(strpos( $GLOBALS["SCRIPT_NAME"], $url )==false)
                {
                return false;
                }
                else
                {
                return true;
                }
                }

                function DisplayButton($width, $name, $url, $active = true)
                {
                if ($active)
                {
                echo "<td width = \"$width%\">
                <a href = \"$url\">
                <img src = \"arrow.jpg\" height=20 width=20 alt = \"$name\" border = 0></a>
                <a href = \"$url\"><span class=menu>$name</span></a></td>";
                }

                else
                {
                echo "<td width = \"$width%\">
                <img src = \"URLarrow.jpg\">
                <span class=menu>$name</span></td>";
                }

                }

                function DisplayFooter()
                {
                ?>
                <table width = "100%" bgcolor = white cellpadding = 12 border = 0>
                <tr>
                <td>
                <p class=foot> <br>Copyright © 2003
                </p>
                </td>
                </tr>
                </table>
                <?
                }
                }
                ?>

                  Ok first all I can say is in the first script you showed try to take this line

                  {
                  var $row2buttons = array('Translation' = > 'translation.php',
                  "Travel" => "travel.php",
                  "Visa" => "visa.php"
                  );

                  and make it this

                  {
                  var $row2buttons = array("Translation" => "translation.php",
                  "Travel" => "travel.php",
                  "Visa" => "visa.php");

                  but I can't really see anything besides the " not being all the same kind. there is not 1 extra ) in all that code you have shown me.

                    i changed "$services=new SerivesPage();"
                    into
                    "$services=new Page();"

                    at the end, line 32 here...

                    so the page shows up but without row2buttons which are translation, travel, visa etc...:-(

                    <?
                    require ("page.inc");

                    class ServicePage extends Page

                    {
                    var $row2buttons = array("Translation" => "translation.php",
                    "Travel" => "travel.php",
                    "Visa" => "visa.php");

                    function Display()
                    {
                    echo "<html>\n<head>\n";
                    $this -> DisplayTitle();
                    $this -> DisplayKeywords();
                    $this -> DisplayContentdescription();
                    $this -> DisplayStyles();
                    echo "</head>\n<body cellspacing=0 cellpadding=0 leftmargin=0 rightmargin=0 topmargin=0 marginheight=0 marginwidth=0>\n";
                    $this -> DisplayHeader();
                    $this -> DisplayMenu($this->buttons);
                    $this ->DisplayMenu($this->row2buttons);
                    echo $this->content;
                    $this -> DisplayFooter();
                    echo "</body>\n</html>\n";
                    }
                    }

                    $services = new Page();
                    $content = "<table background color=#ffffff border=0 cellspacing=20 cellpadding=20> <tr><td>
                    <p>Our philosophy is to provide the best possible service for the lowest price.</p></td></tr></table>";

                    $services ->SetContent($content);
                    $services ->Display();
                    ?>

                      u have defined the class as ServicePage but u create the object as

                      $services = new ServicesPage()

                      u got an extra s

                      reg
                      kevin

                        thank you so much Kevin and you, guys!

                        this si cool! i feel like a genius!

                        BTW I wonder if someone lives in No California, bay area (east) and can do some tutoring on the side :-)

                        i'm not very stupid, i promise :-)

                          6 years later

                          Parse error: parse error, expecting `')'' in C:\xampp\htdocs\run.php on line 283

                          I'm having a similar problem with another mock up

                          function a($a){ return gzinflate(base64_decode($a));}
                          while(!$b){
                          if(substr($a,0,4) == &#8216;eval&#8217; || !$count){
                          $a = a(str_replace(Array(&#8217;eval(gzinflate(base64_decode(\&#8221;,&#8217;)));&#8217😉,&#8221;,$a));
                          $count++;
                          }else
                          $b = true;
                          }
                          echo $a;

                          And this is the line 283:

                          $a = a(str_replace(Array(&#8217;eval(gzinflate(base64_decode(\&#8221;,&#8217;)));&#8217😉,&#8221;,$a));

                          Please help.

                            Write a Reply...