This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
website syntax error

For some reason I keep getting a syntax error when I try to access the website even internally through the file manager. I suspect the problem might be in the index page but there are other pages as well. When I bring up the coded page in the file manager the first line has a ? proceeding the HTML or PHP code where the other pages that do work do not have the ? there.

Browser: Firefoz

OS: OSX

Re: website syntax error

The ? isn't supposed to be there


I had an editor I used that would put the ? in there when it wasn't supposed to be

Re: website syntax error

This is the error that I get when I try to access your web site.

Parse error: syntax error, unexpected "<" in /misc/30/416/624/257/5/user/web/ivybakeshoppe.com/index.php on line 2


This indicates that you are using a PHP file for your index. PHP files have the following general form. In front of the "?" there should be a "<" character. The error indicates that you are missing this character.

Code:
<span style="font-weight:bold;"><?php</span>
/* PHP code, variables, calculations, etc.. */
...........
/* End of PHP code */
<span style="font-weight:bold;">?></span>


It is also possible to include HTML within a PHP file. The following code snippet simply creates a string variable named "HTML_Code" and adds HTML code to it. At the end it writes the variable contents to the browser. This kind of setup could extract data from a form, process it, and then include it in the page response.

Code:
<?php
/* HTML code being added to a variable */
$HTML_Code = <<<EOD
<html>
<head>
<title>Title</title>
</head>
<body>
<div>Yadada yadada yadada!</div>
</body>
</html>
EOD;
/* Output the contents of the variable to the browser */
echo "$HTML_Code";
/* End of PHP code */
?>


I'm not sure the Visual editor can handle PHP files. The Visual editor has a tendency to modify code that it doesn't understand. It's probably best to only use the Text editor with PHP files. I use HTML-Kit for all of my editing and it doesn't have any problem working with HTML, PHP, and Javascript correctly.

Browser: Firefox, Netscape, Sea Monkey, Internet Explorer, .....

OS: Solaris (Sparc,x86), Linux, XP