For those of you who have played with phpiCalendar, you know how easy it is to setup. I wanted to "take it up a notch" and get the calendar working inside a web page of mine. That is, having the calendar display with my site's design, not of a frame, not on a new windows.
To do so, I created a php file that contains the html for my site and where I want the calendar displayed, I included the file that I wanted to display (month.php), turned the body of month into a function and called from there. Well, all hell broke lose.
Here is the structure of the site
+-php
+-myFile.php
+-resources
+-phpicalendar
+-month.php
+-functions
+-ical_parser.php
So I have myFile.php import month.php and call it via a function. month.php imports other files inside the function directory and that is how it goes.
The code for the beginning of month is the following:
define('BASE', './');
require_once(BASE.'functions/ical_parser.php');
And here is where it fails, I get the following:
Warning: start(./functions/ical_parser.php): failed to open stream: No such file or directory in /Users/sabor/Sites/globalstandard/resources/phpicalendar/month.php on line 28
HOWEVER, when I run phpiCalendar from index.php, things work OK. Here is the code for index.php (which does nothing related to the previous error message):
<?php
if (!isset($ALL_CALENDARS_COMBINED)) $ALL_CALENDARS_COMBINED = 'all_calendars_combined971';
include "./config.inc.php";
if (isset($_COOKIE['phpicalendar'])) {
$phpicalendar = unserialize(stripslashes($_COOKIE['phpicalendar']));
$default_view = $phpicalendar['cookie_view'];
}
if ($printview_default == 'yes') {
$printview = $default_view;
$default_view = "print.php";
} else {
$check = array ('day', 'week', 'month');
if (in_array($default_view, $check)) {
$default_view = $default_view . '.php';
} else {
die;
}
}
if(isset($_GET['cpath'])){
$default_view .= '?cpath='.$_GET['cpath'];
}
header("Location: $default_view");
?>
Any ideas why month.php is not able to find the ical_parser function when called from another file? Sorry for the long post, I am so dead sure no one will ever read this...
To do so, I created a php file that contains the html for my site and where I want the calendar displayed, I included the file that I wanted to display (month.php), turned the body of month into a function and called from there. Well, all hell broke lose.
Here is the structure of the site
+-php
+-myFile.php
+-resources
+-phpicalendar
+-month.php
+-functions
+-ical_parser.php
So I have myFile.php import month.php and call it via a function. month.php imports other files inside the function directory and that is how it goes.
The code for the beginning of month is the following:
define('BASE', './');
require_once(BASE.'functions/ical_parser.php');
And here is where it fails, I get the following:
Warning: start(./functions/ical_parser.php): failed to open stream: No such file or directory in /Users/sabor/Sites/globalstandard/resources/phpicalendar/month.php on line 28
HOWEVER, when I run phpiCalendar from index.php, things work OK. Here is the code for index.php (which does nothing related to the previous error message):
<?php
if (!isset($ALL_CALENDARS_COMBINED)) $ALL_CALENDARS_COMBINED = 'all_calendars_combined971';
include "./config.inc.php";
if (isset($_COOKIE['phpicalendar'])) {
$phpicalendar = unserialize(stripslashes($_COOKIE['phpicalendar']));
$default_view = $phpicalendar['cookie_view'];
}
if ($printview_default == 'yes') {
$printview = $default_view;
$default_view = "print.php";
} else {
$check = array ('day', 'week', 'month');
if (in_array($default_view, $check)) {
$default_view = $default_view . '.php';
} else {
die;
}
}
if(isset($_GET['cpath'])){
$default_view .= '?cpath='.$_GET['cpath'];
}
header("Location: $default_view");
?>
Any ideas why month.php is not able to find the ical_parser function when called from another file? Sorry for the long post, I am so dead sure no one will ever read this...