Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sabor

macrumors regular
Original poster
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...😀
 
Here is the folder hierarchy since the forum post did not pay attention to my whitespaces.
 

Attachments

  • Picture 4.jpg
    Picture 4.jpg
    13.5 KB · Views: 279
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.