FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » A Christmas PHP Story

   
Author Topic: A Christmas PHP Story
Phanto
Member
Member # 5897

 - posted      Profile for Phanto           Edit/Delete Post 
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.

Posts: 3060 | Registered: Nov 2003  |  IP: Logged | Report this post to a Moderator
TomDavidson
Member
Member # 124

 - posted      Profile for TomDavidson   Email TomDavidson         Edit/Delete Post 
Add a punk rock chick with a sword and you'd have a Neal Stephenson novel.
Posts: 37449 | Registered: May 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
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?

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Phanto
Member
Member # 5897

 - posted      Profile for Phanto           Edit/Delete Post 
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.

Posts: 3060 | Registered: Nov 2003  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Since you're getting a blank page, what errors are hitting your logs?
Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Phanto
Member
Member # 5897

 - posted      Profile for Phanto           Edit/Delete Post 
The last log entry is from an hour ago, tho.
Posts: 3060 | Registered: Nov 2003  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
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.

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Phanto
Member
Member # 5897

 - posted      Profile for Phanto           Edit/Delete Post 
Turning the error reporting doesn't change anything.

Thanks for all the help so far btw [Smile] .

Posts: 3060 | Registered: Nov 2003  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
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.

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

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