Parse error: syntax error, unexpected T_STRING in /home/a3442751/public_html/index.ht

Hi!

I have a problem with my web.

We make a webpage with iweb program, we upload the webpage and we have always the same error:

Parse error: syntax error, unexpected T_STRING in /home/a3442751/public_html/index.html on line 1

We look the forum and we find the solution

Parse error: syntax error, unexpected T_STRING

We aplicated the “solution” and then there is another problem, our webpage have and menu/index and is deleted.

Whar can I do?

Sorry for may bad english.

could you paste us the content of index.html please

the original index.html
<?xml version=“1.0” encoding=“UTF-8”?><!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”><html xmlns=“http://www.w3.org/1999/xhtml”><head><title></title><meta http-equiv=“refresh” content=“0;url= hasiera.html” /></head><body></body></html>

the hasiera.html
<?xml version=“1.0” encoding=“UTF-8”?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“es”>
<head><meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8” />

&lt;meta name="Generator" content="iWeb 3.0.1" /&gt;
&lt;meta name="iWeb-Build" content="local-build-20090914" /&gt;
&lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /&gt;
&lt;meta name="viewport" content="width=700" /&gt;
&lt;title&gt;hasiera&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" media="screen,print" href="hasiera_files/hasiera.css" /&gt;
&lt;!--[if lt IE 8]&gt;&lt;link rel='stylesheet' type='text/css' media='screen,print' href='hasiera_files/hasieraIE.css'/&gt;&lt;![endif]--&gt;
&lt;!--[if gte IE 8]&gt;&lt;link rel='stylesheet' type='text/css' media='screen,print' href='Media/IE8.css'/&gt;&lt;![endif]--&gt;
&lt;script type="text/javascript" src="Scripts/iWebSite.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="Scripts/Widgets/SharedResources/WidgetCommon.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="Scripts/Widgets/Navbar/navbar.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="Scripts/iWebImage.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="hasiera_files/hasiera.js"&gt;&lt;/script&gt;

</head>
<body style="background: rgb(0, 0, 0); margin: 0pt; " onload=“onPageLoad();” onunload=“onPageUnload();”>
<div style="text-align: center; ">
<div style="margin-bottom: 0px; margin-left: auto; margin-right: auto; margin-top: 0px; overflow: hidden; position: relative; word-wrap: break-word; background: rgb(0, 0, 0); text-align: left; width: 700px; " id=“body_content”>
<div style="margin-left: 0px; position: relative; width: 700px; z-index: 0; " id=“nav_layer”>
<div style="height: 0px; line-height: 0px; " class=“bumper”>*</div>
<div class=“com-apple-iweb-widget-navbar flowDefining” id=“widget0” style="margin-left: 15px; margin-top: 0px; opacity: 1.00; position: relative; width: 668px; z-index: 1; ">

        &lt;div id="widget0-navbar" class="navbar"&gt;

  
          &lt;div id="widget0-bg" class="navbar-bg"&gt;

    
            &lt;ul id="widget0-navbar-list" class="navbar-list"&gt;

<li></li>
</ul>

</div>

</div>
</div>
<script type=“text/javascript”><!–//–><![CDATA[//><!–
new NavBar(‘widget0’, ‘Scripts/Widgets/Navbar’, ‘Scripts/Widgets/SharedResources’, ‘.’, {“current-page-GUID”: “AB9216AB-9F17-416A-A9D3-0FB2B54C54D0”, “path-to-root”: “”, “isCollectionPage”: “NO”, “navbar-css”: ".navbar {
font-family: Arial, sans-serif;
font-size: 1em;
color: #A1A1A1;
margin: 9px 0px 6px 0px;
line-height: 30px;
}

.navbar-bg {
text-align: center;
}

.navbar-bg ul {
list-style: none;
margin: 0px;
padding: 0px;
}

li {
list-style-type: none;
display: inline;
padding: 0px 10px 0px 10px;
}

li a {
text-decoration: none;
color: #A1A1A1;
}

li a:visited {
text-decoration: none;
color: #A1A1A1;
}

li a:hover
{
text-decoration: none;
color: #eee;
}

li.current-page a
{
text-decoration: none;
color: #fff;
font-weight: bold;

}"});
//–><!]]></script>
<div style="clear: both; height: 0px; line-height: 0px; " class=“spacer”></div>
</div>
<div style="height: 147px; margin-left: 0px; position: relative; width: 700px; z-index: 10; " id=“header_layer”>
<div style="height: 0px; line-height: 0px; " class=“bumper”>
</div>
<div id=“id1” style="height: 49px; left: 341px; position: absolute; top: 69px; width: 328px; z-index: 1; " class=“style_SkipStroke shape-with-text”>
<div class=“text-content style_External_328_49” style="padding: 0px; ">
<div class=“style”></div>
</div>
</div>

      &lt;div id="id2" style="height: 124px; left: 230px; position: absolute; top: 23px; width: 438px; z-index: 1; " class="style_SkipStroke shape-with-text"&gt;
        &lt;div class="text-content style_External_438_124" style="padding: 0px; "&gt;
          &lt;div class="style"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      


      &lt;div style="height: 1px; width: 634px;  height: 1px; left: 32px; position: absolute; top: -1px; width: 634px; z-index: 1; " class="tinyText"&gt;
        &lt;div style="position: relative; width: 634px; "&gt;
          &lt;img src="hasiera_files/shapeimage_1.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 634px; " /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      


      &lt;div style="height: 79px; width: 373px;  height: 79px; left: 290px; position: absolute; top: 34px; width: 373px; z-index: 1; " class="tinyText style_SkipStroke_1"&gt;
        &lt;img src="hasiera_files/XX%20urte.jpg" alt="" style="border: none; height: 79px; width: 373px; " /&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div style="margin-left: 0px; position: relative; width: 700px; z-index: 5; " id="body_layer"&gt;
      &lt;div style="height: 0px; line-height: 0px; " class="bumper"&gt;*&lt;/div&gt;
      &lt;div style="height: 230px; width: 495px;  height: 230px; left: 166px; position: absolute; top: -12px; width: 495px; z-index: 1; " class="tinyText reflection_0"&gt;
        &lt;div style="position: relative; width: 495px; "&gt;
          &lt;img src="hasiera_files/shapeimage_2.png" alt="" style="height: 230px; left: 0px; position: absolute; top: 0px; width: 495px; " /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      


      &lt;div style="height: 71px; width: 357px;  height: 70px; left: 308px; position: absolute; top: 288px; width: 357px; z-index: 1; " class="tinyText"&gt;
        &lt;div style="position: relative; width: 357px; "&gt;
          &lt;img src="hasiera_files/shapeimage_3.png" alt="" style="height: 71px; left: 0px; position: absolute; top: 0px; width: 357px; " /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      


      &lt;div style="height: 184px; width: 160px;  height: 184px; left: 525px; position: absolute; top: 83px; width: 159px; z-index: 1; " class="tinyText shadow_0"&gt;
        &lt;div style="position: relative; width: 159px; "&gt;
          &lt;img src="hasiera_files/shapeimage_4.png" alt="" style="height: 184px; left: 0px; position: absolute; top: 0px; width: 160px; " /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      


      &lt;div style="height: 159px; width: 94px;  height: 159px; left: 569px; position: absolute; top: 378px; width: 93px; z-index: 1; " class="tinyText reflection_1"&gt;
        &lt;div style="position: relative; width: 93px; "&gt;
          &lt;img src="hasiera_files/shapeimage_5.png" alt="" style="height: 159px; left: 0px; position: absolute; top: 0px; width: 94px; " /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      


      &lt;div style="height: 308px; width: 308px;  height: 308px; left: 0px; position: absolute; top: -145px; width: 308px; z-index: 1; " class="tinyText shadow_1 reflection_2"&gt;
        &lt;div style="position: relative; width: 308px; "&gt;
          &lt;img src="hasiera_files/shapeimage_6.png" alt="" style="height: 308px; left: 0px; position: absolute; top: 0px; width: 308px; " /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      


      &lt;div id="id3" style="height: 154px; left: 33px; position: absolute; top: 379px; width: 485px; z-index: 1; " class="style_SkipStroke_2 shape-with-text"&gt;
        &lt;div class="text-content style_External_485_154" style="padding: 0px; "&gt;
          &lt;div class="style"&gt;
            &lt;p style="padding-top: 0pt; " class="paragraph_style"&gt;Ongi etorriak Indar Gorriko webgune berri honetara.1987. urtetik Osasunari animatzen dion taldea gara. Onenean zein txarrean BETI OSASUNA ¡!!!&lt;br /&gt;&lt;/p&gt;
            &lt;p class="paragraph_style"&gt;*&lt;br /&gt;&lt;/p&gt;
            &lt;p style="padding-bottom: 0pt; " class="paragraph_style_1"&gt;Bienvenidos a la nueva web de Indar Gorri. Somos el grupo que anima a Osasuna desde 1987. En lo bueno y lo malo BETI OSASUNA.&lt;/p&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      


      &lt;div style="height: 72px; width: 235px;  height: 72px; left: 29px; position: absolute; top: 290px; width: 235px; z-index: 1; " class="tinyText style_SkipStroke_1"&gt;
        &lt;img src="hasiera_files/ongietorri.jpg" alt="" style="border: none; height: 72px; width: 235px; " /&gt;
      &lt;/div&gt;
      &lt;div style="height: 533px; line-height: 533px; " class="spacer"&gt;*&lt;/div&gt;
    &lt;/div&gt;
    &lt;div style="height: 150px; margin-left: 0px; position: relative; width: 700px; z-index: 15; " id="footer_layer"&gt;
      &lt;div style="height: 0px; line-height: 0px; " class="bumper"&gt;*&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

</body>
</html>

the original index.html
<?xml version=“1.0” encoding=“UTF-8”?><!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”><html xmlns=“http://www.w3.org/1999/xhtml”><head><title></title><meta http-equiv=“refresh” content=“0;url= hasiera.html” /></head><body></body></html>

Remove “<?xml version=“1.0” encoding=“UTF-8”?>” from the top of each file and it should work fine

If we apply this “solution”, we eliminate the error,
but the website disappears top menu

The reason the navigation bar disappears is because it is wrapped inside CDATA tags.
Remove the xml declaration (like sandstorm140 said) AND the CDATA tags please.

Regarding the T_STRING error:
As others have mentioned this is due to the ?'s inside the encoding type declaration,
(<?xml version=“1.0” encoding=“utf-8”?>) above the DOCTYPE declaration.
The main problem i have with removing the encoding declaration altogether, is that the page will then no longer pass the w3c validation test. (in my case going from valid XHTML 1.0 strict, to HTML 4 transitional i think it was, with numerous errors)
After a lot of tinkering around I found:
Removing the ?'s will also cause the page to not w3c validate.
However, if you remove the ?'s and enclose the entire declaration inside comment tags,
like this: <!-- <xml version=“1.0” encoding=“utf-8”> --> the page will validate!
And the page will open without the T_STRING error.(at least my page is.)
There is one small catch however; an empty comment tag will be displayed above the web page.
Maybe someone has a better fix, or a way to fix this fix. :slight_smile:

Update to my last post:
Good news! , after noticing that only my index page was displaying the empty comment tag over the page, I checked that page and noticed that I had inadvertently left out the exclamation mark after the opening bracket. Adding the exclamation mark seems to have fixed the problem.
My pages now open without the T_STRING error and without the empty comment tag.

So to summarize: to eliminate the T_STRING error and have a page that will still pass W3C validation try this fix:
replace <?xml version=“1.0” encoding=“utf-8”?>
with this: <!-- <xml version=“1.0” encoding=“utf-8”> -->
I hope this works for anyone else who has run into this problem.
P.S. i’m not sure why it works, I’m fairly new to web design (5-6 months) and haven’t learned anything about php yet.

T_STRING Error is a PHP error… Could you please copy paste the entire error message?

Well I am totally at a loss as to how it happened, I tested and retested and retested and was sure my fix was solving the T_string error problem. (apparently it wasn’t!)
The only thing I can figure is that I had way too many tabs, windows, browsers and copies of files open that I was bouncing around between.
It seemed that only if I included my prologue encoding declaration fix would my pages validate properly without the T_string error .
It now seems that the only thing that was allowing them to validate properly may have been the inclusion of the following line within my document <head> tags:
<meta http-equiv=“content-type” content=“text/html;charset=utf-8” />
(even though i was sure I had taken that line out)
However even as I write this I am still testing the w3 validator and I am finding some strange things.
Earlier I found that when there was no character encoding declaration in pages that I uploaded for testing to the w3 validator, I would get some explicit warnings about that fact.
Yet a few moments ago I tried validating the same file with no encoding declaration, and without the meta tag shown above and the validator is now saying there are no problems and the page passes as XHTML 1.0 Strict, with no warnings at all about the character encoding.
What the ?! is going on here?
Are my uploaded pages being cached somewhere between my hard drive and w3.org?
Something is very, very fishy here.
Is this why so many Web sites do not to pass a w3 validator test when I pass it the URL for that page in order to be tested?
The fact that Chrome shows a ‘choose file’ button on the left side of the file upload box in validator whereas Firefox has a ‘browse’ button on the right side of the file upload box instead, when they each have the validator open is not a big deal, but this inconsistency in validation makes no sense to me at all.
I really need to take a break.

Well I think I’ve found out why this problem was occurring, previously when I uploaded pages
there was often a UTF-8 byte order marker included at the very beginning of the page.
This was quite visible as a string of strange characters which I simply edited out using the file manager’s html editor.
However at some point my uploaded files (created with notepad) started including only a tiny dot at the beginning of the page as a UTF-8 byte order marker.
So tiny in fact, that I did not even notice it there at first.
This marker apparently alerts the W3C validator to the the fact that the page uses UTF-8 character encoding, even though there is no other encoding specified in the document.
This allows the page to validate without warnings about the lack of a character encoding
declaration.
It does warn about the Byte Order Marker however.
It took me a while to put 2 and 2 together.
This makes sense considering it is a UTF-8 byte order marker after all.
Oh well live and learn.

@new 2web

right i m having the same error and using iweb, now what i don’t understand is how do i change the html code in iweb…

can you please give me run down of the process…

thank you very much…

cheers…

can you switch to html mode or use something else that will let you switch to html and remove it or at least let you configure it not to output that code.

see that is the problem… it wont let me edit any html inside the program… but it will publish to a folder and then i will have to open html in an external editor and save it back… so i wanted to know what easy editor i can use… when i open the html file in text edit it comes up as blank…

thanks…

I assume you are using Mac, give this a try.

ma4354

The administrator here (chanh) seems very knowledgeable and top of things ( judging by the number of posts (1,160 wow) so I would trust chanh’s judgement on this issue over mine.
(I’m still fairly new to web design.)
I’m not sure if you’ve tried using the 000webhost’s built in file manager to edit the file.
You can also use it to remove the line above the <!DOCTYPE html PUBLIC "-//W3C//…>
declaration.
That is the line that was causing the problem for me.
(<?xml version=“1.0” encoding=“UTF-8”?>)
I then had to add the following line between my html <head> and </head> tags:
<meta http-equiv=“content-type” content=“text/html;charset=utf-8” />
(assuming you are using UTF-8 encoding.)
It may be basically the same if you are specifying different encoding
This, as far as I can tell, specifies UTF-8 encoding at the “document level” at least, which seems to keep the W3C validator happy.
I hope we were able to help, cheers.

You don’t have to delete anything. (Aside: I NEVER make forum posts but because this problem gave me so much of a headache, I thought I’d share).
Anyways, back to what I was saying.

  1. Go to your “Public_html” folder and create new file
  2. Type the following code (no quotes) “php_value short_open_tag off”
  3. Save as .htaccess
  4. Repeat this process within your root folder (and wherever else an “index.html” file is found)

Done.

If for some reason you are using another web host and it doesn’t let you create a file within your File Manager, save the code in NotePad or TextEdit but don’t call it .htaccess since the computer shouldn’t let you. Call it whatever and just rename it once you’ve uploaded it to your website folder.

**The nice thing about this is that now you can forget about it forever since “Publishing Entire Site” on iWeb doesn’t remove the .htaccess file after publishing

Worked perfectly for me! Thanks!!

Wow, I love you! This error message had me pissed off for days.