To anyone who does web coding

Srentiln

minr op since Nov 2011
Op
Oct 28, 2013
1,934
838
Hoping that someone can point to why something is going funky in my formatting.

I'm trying to create a small collection of webpages for my role playing games group (things like D&D) and for some reason my calender page code is adding spaces to the page that are not in the coding.

If you think you can figure it out, please tell me because I'm at a loss:

http://ck9.outpost2.net/RolePlayGroup/index.php?p=3
 

skyerzz

Awesome
Op
Nov 2, 2013
554
228
Where exactely is it putting in spaces? i might be completely blind or it is normal for me?
 

jagman77

Killer of Very Large Horses
Op
Oct 27, 2013
344
129
Again, I cant see any obvious spaces. Ive had a similar issue before, but the coding was a bit more complex then this, so Im not sure about it.

could you add a screenshot just highlighting where the issues are?
 

Srentiln

minr op since Nov 2011
Op
Oct 28, 2013
1,934
838
I have tried it in both Chrome and IE, both insert that space in there, but it is only select-able in Chrome.
 

Attachments

Srentiln

minr op since Nov 2011
Op
Oct 28, 2013
1,934
838
Zath didn't see anything that would cause it either, so here's the full code with the php (since I haven't worked on any of the security stuff for it yet)

Edit: added explanations

main index.php code
PHP:
<?php
$p = $_GET['p'];
if($_GET['p'] == '')
{
  $p = "1";
}
function pagechange($p)
{
  include("header.html");
  echo "<table cols='2' border='0' cellpadding='0' cellspacing='0' align='center'>";

/*space for a logo*/
  echo "<tr><td width='15%'></td>";

  echo "<td width='14%'>";
  include('nav.html');

 /*creates a separation line between navigation and content */
  echo "</td></tr><tr><td height='1' bgcolor='#000000'></td><td height='1' bgcolor='#00AAFF'></td><td height='1' bgcolor='#00AAFF'></td><td height='1' bgcolor='#00AAFF'></td><td height='1' bgcolor='#00AAFF'></td><td height='1' bgcolor='#00AAFF'></td><td height='1' bgcolor='#00AAFF'></td></tr></table>";

/*I just like switches better than a long list of if elseif's*/
  switch ($p)
  {
    case '1':
    include('about.html');
    break;
    case '2':
    include('mems.html');
    break;
    case '3':
    include('cal.html');
    break;
    case '4':
    include('files.html');
    break;
    case '5':
    include('login.html');
    break;
  }
  include('footer.html');
}
pagechange($p);
?>
and the code for the calender page:
Code:
<?php

$time = time();
$numDay = date('d', $time);
$numMonth = date('m', $time);
$strMonth = date('F', $time);
$numYear = date('Y', $time);
$firstDay = mktime(0,0,0,$numMonth,1,$numYear);
$daysInMonth = cal_days_in_month(0, $numMonth, $numYear);
$dayOfWeek = date('w', $firstDay);
?>

<center>
<table border='1' width='90%'>
<caption><b><? echo $strMonth; ?></b></caption>
<thead>
  <tr>
  <th abbr="Sunday" scope="col" title="Sunday">S</th>
  <th abbr="Monday" scope="col" title="Monday">M</th>
  <th abbr="Tuesday" scope="col" title="Tuesday">T</th>
  <th abbr="Wednesday" scope="col" title="Wednesday">W</th>
  <th abbr="Thursday" scope="col" title="Thursday">T</th>
  <th abbr="Friday" scope="col" title="Friday">F</th>
  <th abbr="Saturday" scope="col" title="Saturday">S</th>
  </tr>
</thead>
<tbody>
  <tr>
<?

if(0 != $dayOfWeek)
  {
  echo "<td colspan='".$dayOfWeek."'> </td>";
  }

for($i=1;$i<=$daysInMonth;$i++)
  {
  if($i == $numDay)
    {
    echo "<td valign='top' style='background: #00CC00;height: 200px'><b>";
    }
  else
    {
    echo "<td valign='top' style='height: 200px'><b>";
    }
  echo $i."</td>";
  if(date('w', mktime(0,0,0,$numMonth, $i, $numYear)) == 6)
    {
    echo "</b>\n<br>\n<br>";
    //future check for events in the database
    echo "</tr><tr>";
    }
  }
?>

  </tr>
</tbody>
</table>
</center>
 
Last edited:

skyerzz

Awesome
Op
Nov 2, 2013
554
228
in chrome, html, it gets displayed as
HTML:
<center>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<table border="1" width="90%">
<caption>
<b>November</b>
</caption>
<thead>
All brakes would explain why it gets to there, yet i dont know why it puts the brakes in.

It puts the brakes between these:
Code:
<center>
<table border='1' width='90%'>
Dont know if anyone needs this info, but there are 10 brakes total.
 

TheForgottenUser

Honorary green
Whitey
Nov 3, 2013
584
232
I'll take a look at this when I get home and try to help.

EDIT: Why aren't you just using something like Bootstrap instead? Also, why do it in PHP? I lied. I'll look at this after I finish my spawn. Blie and I are furiously attempting to finish it within the next nine hours and one minute.
 
Last edited:

Srentiln

minr op since Nov 2011
Op
Oct 28, 2013
1,934
838
in chrome, html, it gets displayed as
HTML:
<center>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<table border="1" width="90%">
<caption>
<b>November</b>
</caption>
<thead>
All brakes would explain why it gets to there, yet i dont know why it puts the brakes in.

It puts the brakes between these:
Code:
<center>
<table border='1' width='90%'>
Dont know if anyone needs this info, but there are 10 brakes total.

That's so strange...I don't have any of those in the base code

And forgot: I am using php because it is what I know. I plan on tying in to a database of events and a lot of what I need for that is PHP based
 

jagman77

Killer of Very Large Horses
Op
Oct 27, 2013
344
129
Had a quick talk with dad, here is his suggestions

remove all <center> tags to begin with since they are not html5 compliant.
<html> doctype at the top is HTML5, so try this to begin with

http://www.w3schools.com/tags/tag_center.asp

also remove the carriage return after the <?php tags in the loop inside the table and the carriage return before the ?> inside the loop
 

Srentiln

minr op since Nov 2011
Op
Oct 28, 2013
1,934
838
So many changes since I've done anything, heh

I don't have a carriage return...I have newlines embedded in the echos so the html is properly separated in the page code, but no /r

Edit: decided to look at just the calender page on its own
Edit 2: changed the file to be php base instead of html base, fixed the breaking issue http://ck9.outpost2.net/RolePlayGroup/pages/cal.php

For some reason, the page itself is adding the breaks...
 
Last edited:
Top