Jump to content

unexpected T_STRING [AT] <?php


Tsjeef

Recommended Posts

Goodevening,

 

I've just started making websites using php and I hope I've done enough internet research, so that I don't ask silly questions or already asked problems. I've created a header on a local server (WAMP) and it works perfectly, but I want to show this to friends so I tried to put it online on my personal webspace from the provider one.com. But suddently I get an error there while my files are identically to the onces running local.

 

This is the error shown:

Parse error: syntax error, unexpected T_STRING in /customers/nickrobyn.be/nickrobyn.be/httpd.www/functions.php  on line 1

 

This error referring to the following php file:

<?php
function drawHeader()
{
echo('<div id="header"></div>');
}
function drawTopMenu()
{
echo('<div id="topmenu">');
echo('<div class="right"><a href="login.php">Login</a></div>');
echo('<div class="middle"><a href="contact.php">Contact</a></div>');
echo('<div class="left"><a href="index.php">Home</a></div></div>');

}
?>

 

I've read online that this error is reffering to a syntax error but can't find one near <?php, I hope you guys can help me and I hope I didn't get on your nerves by posting another 'retard' post. Here are the other files I use to create my site (except pictures ofcourse):

 

Index page:

<!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>CDS Antwerpen</title>
<link rel="shortcut icon" href="style/images/CDSfavicon.ico" >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style/style.css" type="text/css" rel="stylesheet" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss.php" />
<script src="style/script.js" type="text/javascript"></script>
<style type="text/css">
</style>
</head>
<body>
	<?php
		include 'functions.php';
	?>
	<div id="wrapper">	
	<?php 
		drawTopMenu();
		drawHeader();

	?>
	<div id="push"/>
	</div>
</body>
</html>

 

Style.ccs:

/* stijlen die toegepast moeten worden op heel de pagina, veelal om algemene lettertypes in te stellen en randen en marges te vermijden */

* {
margin: 0;
}

html, body {
background-color:#5E4A40;
height: 100%;
font-family:Arial, Helvetica, sans-serif;
text-decoration: none;
color:#FFFFFF;
min-width: 1000px;
margin: 0;
background-image: url(images/bg.png);
background-color: #DCDCDC;
background-repeat:repeat-x;
margin-bottom: 1px;
}

/* deze 'wrapper' bevat alle andere divs, is 1000 pixels breed en zorgt er vooral voor dat alles gecentreerd wordt */	
#wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
width: 1000px;
margin: 0 auto -174px;
}

/* de volgende bepalen de stijlen voor het bovenste menu waarin de voornaamste usercontrols voorkomen */
#topmenu {
height: 12px;
font-size: small;
width: 1000px;
margin-right: 100px;
}

/* dit is de stijl voor de divs (de knoppen) in het topmenu */
#topmenu div {
float: right;
height: 27px;
padding-top: 20px;
font-size: 12px;
text-align: center;
font-weight: bold;
color: #ccc;
text-shadow: 2px 2px 2px #000;
width: 50%;
}

/* stijl voor de tekst in de knoppen in het topmenu */
#topmenu div a {
font-size: 12px;
font-weight: bold;
color: #ccc;
text-shadow: 2px 2px 2px #000;
text-decoration: none;
height: 100%;
width: 100%;
display: block;
}

#topmenu div a:hover {color:#A3B5B9;}

/*hierna worden de stijlen voor de verschillende knoppen (links, midden, rechts) van het topmenu gedeclareerd */
#topmenu .left {
width: 78px;
background: url(images/topmenu.png) 0 0;
padding-left: 27px;
}

#topmenu .middle {
width: 84px;
background: url(images/topmenu.png) -105px 0;
}

#topmenu .right {
width: 82px;
background: url(images/topmenu.png) -194px 0;
padding-right: 27px;
}

/*hierna worden de css atributen bepaald voor de knoppen in het topmenu als erover 'gehovered' wordt */
#topmenu .left:hover {background: url(images/topmenu.png) 0 -55px;}
#topmenu .middle:hover {background: url(images/topmenu.png) -105px -55px;}
#topmenu .right:hover {background: url(images/topmenu.png) -194px -55px;}
#topmenu div:hover{color:#A3B5B9;}


/* de header met schild & CDS Antwerpen*/
#header { 
height:200px;
background-image: url(images/header.png);
font-size: 12px;
margin-top: 3px;
}

/* vanaf hier worden er algemene stijlen voor heel de site gedefinieerd */

.alignleft {
float: left;
}
.alignright {
float: right;
}

.clear {
clear:both;
}

#push {
height: 200px;
}

Link to comment
https://forums.phpfreaks.com/topic/207744-unexpected-t_string-at/
Share on other sites

If you coded your php file in Windows, there can be end-line consistency errors which can cause the Parser to report a syntax error. I had this problem when i moved a small php cms i made to another online host provider.

 

Firstly i would suggest getting Notepad++ (if you havn't already), there are some very neat, quick-access features that can make your life a lot easier.

 

Once you get notepad++, in _every_ file you upload/make (you can even do it on your local server, windows doesn't seem to care) you:

Go to the Top Menu "Format" (ALT+M), Then select "Convert to UNIX format". Voila.

 

If that doesn't work then you do have some syntax error, somewhere.

 

-cb-

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.