I have a div in my header that I only want to appear on the home page.
<div id="florida">
header content
</div>
The above example makes the div appear on every page. However if I put the following PHP it will show on every page apart from my 'work' page:
<div id="florida"><?php if ($page=="work") echo "</div>" ?>
header content
</div>
However I want it to appear only on the home page so naturally I attempted the following and got a syntax error.
<?php if ($page=="home") echo "<div id="florida">" ?>
What am I doing wrong?
Your quotes confuse PHP:
<?php if ($page=="home") echo "<div id="florida">" ?>
<!-------------------------------------^-------^
Either you need to escape it using:
<?php if ($page=="home") echo "<div id=\"florida\">"; ?>
Or replace it with:
<?php if ($page=="home") echo '<div id="florida">'; ?>
Make sure, you give a ;
at the end of the statement.