PDA

View Full Version : Syntax Error



stormdragon
09-07-2010, 09:52 PM
Can somebody please tell me why I get this error with the following code? It used to work fine when running as localhost though xampp, but now that I've migrated it to a proper webhost its got issues.

Parse error: syntax error, unexpected '<' in /######/footer.php on line 2


<?php>
<hr class="clear" />
</div><!--/page -->
</div><!--/wrapper -->

<div id="footerbg">
<div id="footer">

<hr class="clear" />
</div>
<!--/footer -->
<div id="credits">
<div class="center">Copyright &copy; <?php the_time('Y'); ?>

Thanks

bevy121
10-07-2010, 01:12 AM
the first line declaring the php code tag shouldn't have that closing ">"

it should be this

<?php
not

<?php>

and the last line

<div class="center">Copyright &copy; <?php the_time('Y'); ?>

should be something like this I think


<div class="center">Copyright &copy ?><?php the_time('Y');
?>

Erayd
10-07-2010, 04:12 AM
Remove the entire first line - it serves no purpose, as it's just a self-closing PHP tag. This should also fix your error, unless you're piping that through eval().

The last line is fine, leave it alone - changing it to match Bevy's suggestion will break things.

Finally, what the heck is the_time()? It looks like you've written a custom replacement for the built-in date formatting function - what's wrong with simply using date('Y')?

stormdragon
10-07-2010, 01:24 PM
Hi Guys

Thanks for the replies.

Removing that first line fixed it.
Erayd to be honest I have no idea still trying to learn php, the code simply came from a Wordpress theme that I wanted to give a whirl.