Page 1 of 1
Contact.php
Posted: Fri Oct 14, 2005 11:49 am
by checkerbelt
I've got a site going with simple header.php and footer.php files going. My calendar.php is behaving weird. After it includes the header.php it includes my contact.php file. A separate page on it's own. The phrase "contact" doesn't even appear in my calendar.php or header.php code, and when I remove or rename the contact.php file (to even contact1.php), everything goes back to normal. I've done exhaustive searches on my code, and there aren't any include missteps. My question: Is there something special about the file name "cotanct.php". This is really weird.
Posted: Fri Oct 14, 2005 11:51 am
by foobar
That's indeed a weird problem. Maybe something that the header includes, in turn includes the contact.php file. Do a search for all files with "contact.php" in them. Problems like these can be very aggravating, I know.

Posted: Fri Oct 14, 2005 11:56 am
by checkerbelt
More weird is that only my calendar.php file (below) does it, but all my files include header.php. The phrase "contact" doesn't exist in it. Hold on....
I have files of duplicate names in different directories:
/contact.php (Used to view contacts, includes header)
/include/contact.php (The contact class)
I had assumed the include function includes in the same directory as the script location, but does it search from top down for them?
Code: Select all
<?PHP
include("header.php");
include("include/game.php");
include("include/event.php");
?>
<div class="contentbuffer">
<h2>Calendar</h2>
<?PHP
$offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;
$today = getdate();
$today = getdate($today[0] - (7*60*60));
if (isset($_GET['timestamp']) && is_numeric($_GET['timestamp'])) {
$timestamp = getdate($_GET['timestamp']);
$offset = $timestamp['mon'] - $today['mon'];
}
$day = mktime(0, 0, 0, $today['mon']+$offset, 1, $today['year']);
$end = mktime(0, 0, 0, $today['mon']+$offset+1, 1, $today['year']);
$games = Game::GetGames($day, $end);
foreach($games as $game) {
$date = getdate($game->date);
$cal['games'][$date['mday']][] = $game;
}
$events = Event::GetEvents($day, $end);
foreach ($events as $event) {
$date = getdate($event->date);
$cal['events'][$date['mday']][] = $event;
}
$date = getdate($day);
print("<table id='calendar' cellspacing='0' cellpadding='0'>");
print("<tr><th><a href='?offset=".($offset-1)."'>prev</a></th>");
print("<th colspan='5'>".$date['month']." ".$date['year']."</th>");
print("<th><a href='?offset=".($offset+1)."'>next</a></th></tr><tr>");
print("<tr><th>Sun</th><th>Mon</th><th>Tues</th><th>Weds</th><th>Thurs</th><th>Fri</th><th>Sat</th></tr>");
$date = getdate($day);
for ($ndx = 0; $ndx < $date['wday']; $ndx++)
print("<td class='nonday'></td>");
while ($day < $end) {
$date = getdate($day);
if ($date['mday'] != 1 && $date['wday'] == 0)
print("</tr><tr>");
if ($date['mday'] == $today['mday'] && $date['mon'] == $today['mon'] && $date['year'] == $today['year'])
$class = " class='today'";
else
$class = "";
print("<td $class>");
print($date['mday']);
if (is_array($cal['games'][$date['mday']]))
foreach($cal['games'][$date['mday']] as $game)
print("<br><a href='game.php?game=".$game->id."'>".$game->home->name." x ".$game->away->name."</a>");
if (is_array($cal['events'][$date['mday']]))
foreach($cal['events'][$date['mday']] as $event)
print("<br><a href='event.php?event=".$event->id."'>".$event->title."</a>");
print("</td>");
$day += 60*60*24; // Add one day
}
$date = getdate($day);
if ($date['wday'] > 1) for ($ndx = $date['wday']; $ndx < 7; $ndx++)
print("<td class='nonday'></td>");
print("</tr></table>");
?>
</div>
<?PHP include("footer.php"); ?>
Posted: Fri Oct 14, 2005 11:57 am
by checkerbelt
I have other dup files without any problems, though.
/game.php
/event.php
/include/game.php
/include/event.php