Jump to content


Photo

What am I being asked to do?


  • Please log in to reply
1 reply to this topic

#1 rawky

rawky
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 06 May 2006 - 06:19 PM

Hello all

I am very VERY new at PHP and have been asked to produce some kind of a form page using PHP as part of my course. Now im not trying to skive my way through it by asking someone to do the work for me its just i cant actually understand what im being asked!!! if someone out there could take a look at this description my lecturer has given me and translate it for me that'd be fantastic. Hopefully someone will be able to! :D

Here goes:

"second php/xhtml project due: produce a php webpage that has a form with a text field; it accepts a URL which points at another file, which contains several other URLs, one on each line. The goal is to produce a table, each element of which contains the contents of those other URLs. The number of elements in each row of the table should also be submitted via the form.

Start off by assuming that each of the files contains plaintext; then detect images and html files as well. [There are various ways to get the suffix of a URL; one is to explode the URL on "." and look at the last element of the array.] You might want the trim() function to get rid of whitespace at each end of the URLs. Create your tables without using for loops, foreach loops, while loops or repeat loops. That is, do it all with functions. Note that when embedding html pages inside a table, you only want to display the body; that is, you want to get rid of everything before the "<body>" tag. An easy way to do this is to explode the page contents using "<body>" as the separator.
The contents of the pages are up to you, but remember other people may look at it. Make sure the page is xhtml-validated.

Submit the full URL webpage addresses to NESS. These should include the overall php page, both in the departmental webspace and your university space, and the individual files, saved as .txt files (in either webspace) so I can look at the source with a browser. "


Here's hoping!!

Martin

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 07 May 2006 - 02:12 PM

My interpretation would be as follows.

On your server you have a file called, say, "myfile.txt" which contains something like

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]my.domain.com/path/fileA.txt
my.domain.com/path/fileB.txt
my.domain.com/path/fileC.txt[/quote]

You have to create a form in which you would enter the url of "myfile.txt" plus a number to indicate how many elements on each row (more later)

You process the form data, picking up the filename and open the file.

You then have to get the contents of each of those file (fileA, FileB) etc and display them in a table

+-------------------------------+
|  FileA.txt                    |
+-------------------------------+
|  Contents of fileA            |
|                               |
+-------------------------------+
|  FileB.txt                    |
+-------------------------------+
|  Contents of fileB            |
|                               |
+-------------------------------+
|  FileC.txt                    |
+-------------------------------+
|  Contents of fileC            |
|                               |
+-------------------------------+

I think the number entered on the form is to define a layout like this (number = 2)

+-------------------------+--------------------------+ 
|  FileA.txt              |  FileB.txt               | 
+-------------------------+--------------------------+
|  Contents of fileA      |  Contents of fileB       | 
|                         |                          |
+-------------------------+--------------------------+
|  FileC.txt              |
+-------------------------+
|  Contents of fileC      |
|                         |
+-------------------------+



The next step is try it when "myfile.txt" contains something like

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]my.domain.com/path/fileA.txt
my.domain.com/path/fileB.html
my.domain.com/path/fileC.jpg[/quote]

I cannot understand not being able to use loops but use functions instead. Why must the two be mutually exclusive?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users