Hi fellow coders
I just started coding my website with php but this past two days i'm stuck with this include call. Whenever I add this expression in my code the rest of the page turn blank. For instance if i place it before the header the page is empty, and if i place it after the header the rest of the page is blank.
For now the "functions.inc.php" only contains one function (calendar thingy) that i got from some website.
I think i tried everything: include_once; require and require_once; I also tried to to put the whole code into echo tag, but nothing. The code is below.
Thanks for any help
Here is my "functions.inc.php"
<?php
/*
This file contains all the functions necessary for the website.
*/
// PHP Calendar (version 2.1b)
// [url]http://keithdevens.com/software/php_calendar[/url]
//_see example at [url]http://keithdevens.com/weblog[/url]
// License: [url]http://keithdevens.com/software/license[/url]
function generate_calendar($year, $month, $days = array(), $day_heading_length = 3, $month_href = NULL){
____$first_of_month = mktime(0,0,0,$month,1,$year);
____//remember that mktime will automatically correct if invalid dates are entered
____//for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
____//this provides a built in "rounding" feature to generate_calendar()
____$day_headings = array(); //generate all the day headings according to the current locale
____for($n=0,$t=3*86400; $n<7; $n++,$t+=86400)___//January 4, 1970 was a Sunday
________$day_headings[$n] = gmstrftime('%A',$t); //%A means full textual day name
____$day_headings = array_map('ucfirst',$day_headings); //some locales don't capitalize day names
____list($month, $year, $month_name, $weekday) = explode(',',strftime('%m,%Y,%B,%u',$first_of_month));
____$weekday___%= 7; //strftime gives Monday as 1, Sunday as 7. Adjust so Sunday is 0
____$month_name = ucfirst($month_name); //some locales don't capitalize month names
____$maxdays____= date('t', $first_of_month); //number of days in the month
____$day________= 1; //starting day of the month
____$calendar___= '<table class="calendar">'."\n"; //begin calendar
____//uses a real <caption>. See [url]http://diveintomark.org/archives/2002/07/03[/url]
____$calendar .= '<caption class="month">';
____if($month_href) $calendar .='<a href="'.htmlspecialchars($month_href).'">';
____$calendar .= "$month_name, $year";
____if($month_href) $calendar .= '</a>';
____$calendar .= "</caption>\n";
____$calendar .= '<tr>';
____if($day_heading_length > 0 and $day_heading_length <= 4){
//if day_heading_length is allowed value
________//if day_heading_length is 4, the full name of the day will be printed
________//otherwise, just the first n characters
________foreach($day_headings as $day_heading){
____________$d = ($day_heading_length != 4) ? substr($day_heading,0,$day_heading_length) : $day_heading;
____________$calendar .= "<th abbr=\"$day_heading\">$d</th>";
________}
________$calendar .= "</tr>\n<tr>";
____}
____//take care of the first "empty" days of the month
____if($weekday > 0) $calendar .= '<td colspan="'.$weekday.'"> </td>';
____while($day <= $maxdays){ //print the days of the month
________if($weekday == 7){ //start a new week
____________$calendar .= "</tr>\n<tr>";
____________$weekday = 0;
________}
________if(isset($days[$day]) and is_array($days[$day])){
____________$d = &$days[$day];
____________$link____= isset($d[0]) ? $d[0] : NULL; //PHP notices make me do this
____________$classes = isset($d[1]) ? $d[1] : NULL;
____________$content = isset($d[2]) ? $d[2] : $day;
____________$calendar .= '<td' . ($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
________________($link ? '<a href="'.htmlspecialchars($link).'">' : '').$content.($link ? '</a>' : '').
________________'</td>';
________}
________else $calendar .= "<td>$day</td>";
________$day++; $weekday++;
____}
____//take care of the remaining "empty" days of the month
____if($weekday != 7) $calendar .= '<td colspan="'.(7-$weekday).'"> </td>';
____return $calendar."</tr>\n</table>\n";
}
?>
And here is my "index.php"
<?php
//Include the necessary functions
include ("functions.inc.php");
//Include the rest of the page
include ("header.inc.php");
include ("left.inc.php");
include ("center.inc.php");
include ("right.inc.php");
//Closing Tabs
echo '
</body>
</html> ' ;
?>
Note: I don't know if you see those lines but i guess there are supposed to be spaces. I just copied and paste the code.