John,
I think your best option is to convert their format to XML and then use the
XML to drive your quiz system.
Should be pretty straightforward to convert to XML, cause you don't have to
worry about exploding stuff.  You just have to match patterns and use
str_replace.
Chris


-----Original Message-----
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 23, 2003 10:26 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Parse WebCT quiz


I have done this (below) already. I suppose. I will have to explode by \n.

One of my problems is that with ":QUESTION:{H|T}", the question is on the
next line. Exploding by \n puts my question text into the next line_field[].
"Note: Multiple lines of text are permitted."
Getting that variabnle confuses me, for example.

https://online.csus.edu/web-ct/help/en/designer/quiz/quiz_transfer.html#form
ats

Tested: http://ccl.flsh.usherbrooke.ca/~johj2201/webct_import.php

$fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name']));
fclose($fh);
$lines=explode("\n",$fileContents);
foreach($lines as $line)
{
echo $line."<hr>";
}


-----quiz.txt----------
:TYPE:S
:TITLE:Sample Exercise JQuiz 2 (2)
:CAT:Sample Exercise 2
:QUESTION:H
I have come here <u>a lot</u>.
:ANSWERS:1
:CASE:0
:ANSWER1:How often have you come here?:100:0:0
:ANSWER2:How often have I come here?:100:0:0

:TYPE:MC:1:0:C
:TITLE:Sample JBC Exercise 1 (1)
:CAT:Sample Exercise 1
:QUESTION:H
Which if the following sentences is incorrect?
:ANSWER1:0:H
That's not a very funny joke.
:REASON1:H
:ANSWER2:0:H
The book I'm reading is quite long.
:REASON2:H
:ANSWER3:0:H
He's much taller than me.
:REASON3:H
:ANSWER4:100:H
Anna is more younger than Halley.
:REASON4:H
The corrct response is: "Anna is younger than Halley."

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to