This is topic A Christmas PHP Story in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=050974

Posted by Phanto (Member # 5897) on :
 
It was a few weeks before Christmas and classes for Phanto were coming to a close. Yet somehow Phanto had been given a final project which Phanto had little to no experience in. Determined to make good, Phanto rationalized that this way would teach new skills.

Phanto was currently sitting in the studio, surrounded by christmas style coffee cups from Starbucks and a half eaten bag of candy. Phanto considered the options. Phanto had already located a premade .ics parser. It seemed to be good code, and so jacked it in. The drupal Website Phanto was working on wouldn't let Phanto use a simple include 'xxx.php' statement, so Phanto stuck the code in directly, expecting to later outsource it.

Phanto also had a form on another page that let the user upload their .ics file to the website. Then the form action element would load another page where the following code met them:

if ($_FILES['uploadedcal']) {
$calender = $_FILES['uploadedcal']['tmp_name'];
$icsparser = new iCalReader($calender);
}

Now poor little Phanto was confused. As far as Phanto knew, the $icsparser variable was doing nothing besides being initalized. A check of the inner function -- file_get_contents -- with some debugging revealed it was working. Yet why was the page showing nothing but White?

Phanto was working in a Drupal CMS enviroment, something that provided daily challenge. Worse, Phanto had to present to the team the next day with a working prototype. Taking a sip of coffee, Phanto looked outside the window.

It was a real Christmas dilemma. And time was running out.
 
Posted by TomDavidson (Member # 124) on :
 
Add a punk rock chick with a sword and you'd have a Neal Stephenson novel.
 
Posted by fugu13 (Member # 2859) on :
 
All the work for the ICS parser is done in the constructor for that class.

How are you integrating your code into drupal? Is this a module? If so, what hook is this code getting called within?

Also, what version of PHP are you running?
 
Posted by Phanto (Member # 5897) on :
 
fugu13:

I have a module that exists and is working fine. I pretty much dumped all the code into that module and put the text stuff. I think the hook is the menu() hook.

php version 5.0.4.
 
Posted by fugu13 (Member # 2859) on :
 
Since you're getting a blank page, what errors are hitting your logs?
 
Posted by Phanto (Member # 5897) on :
 
The last log entry is from an hour ago, tho.
 
Posted by fugu13 (Member # 2859) on :
 
Turn PHP error reporting to the max at the start of your code (E_ALL, that is: http://php.net/error_reporting ).

Since you're not seeing anything in the logs, unless logging is turned far too low, the page is probably parsing okay.
 
Posted by Phanto (Member # 5897) on :
 
Turning the error reporting doesn't change anything.

Thanks for all the help so far btw [Smile] .
 
Posted by fugu13 (Member # 2859) on :
 
Are you sure there is nothing in the apache log? There're often separate logs for errors.

In that case, I'd start by putting a print statement after every statement in the parser constructor, preferably that prints something related to the statement just past.

Then see what you get.
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2