Jump to content

Unwanted line break when using PHP


Monk3h

Recommended Posts

My site is constructed with 2 tables, one for the top and one for the bottom.

 

My problem is after adding a small PHP script to the bottom of the Top table a line break has appeared between the top and bottom table.

 

 

any ideas? I haven't used any line breaks anywhere in my PHP script.

Link to comment
Share on other sites

	<?php
$homepage = "index.php";
        if($homepage==$currentpage) {
        Print "<img src='images/rollovers/homemouse_01.png' width='100' height='30'>";

        }else{

Print"<div class='rollover' >

<a href='#'><img src='images/rollovers/home_01.png'
width='100' height='30' border='0'></a>
</div>";

}

$workpage = "work.php";
        if($workpage==$currentpage) {
        Print "<img src='images/rollovers/workmouse_01.png' width='100' height='30'>";

        }else{



Print"<div class='rollover'>

<a href='#'><img src='images/rollovers/work_01.png'
width='100' height='30' border='0'></a>
</div>";


}

?>

Link to comment
Share on other sites

Mate, I don't even know where to begin with that. You are using tables for layout, javascript rollovers, and have invalid code. You have style tags in between the head and body tags, and you are using some deprecated tags. You are also using html tags with an XHTML doctype.

 

It's probably something in the combination of all those things, and no one thing in particular.

 

My recommendation - learn to code CSS and how to write valid code, and start from scratch. And stop using an editor that writes your code for you - you are at their mercy, especially in situations just like this. Code editors never, ever write good code. They are good for someone who doesn't care about 1px alignments and fine tuning things across browsers (i.e. amateurs who are doing it for a hobby), but if you are trying to put together a professional site, you aren't going to be able to do it with the code you have there.

Link to comment
Share on other sites

Then why do you have this in the head?

 

<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.