rawky Posted May 6, 2006 Share Posted May 6, 2006 Hello allI 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! :DHere 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 Quote Link to comment Share on other sites More sharing options...
Barand Posted May 7, 2006 Share Posted May 7, 2006 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.txtmy.domain.com/path/fileB.txtmy.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[code]+-------------------------------+| FileA.txt |+-------------------------------+| Contents of fileA || |+-------------------------------+| FileB.txt |+-------------------------------+| Contents of fileB || |+-------------------------------+| FileC.txt |+-------------------------------+| Contents of fileC || |+-------------------------------+[/code]I think the number entered on the form is to define a layout like this (number = 2)[code]+-------------------------+--------------------------+ | FileA.txt | FileB.txt | +-------------------------+--------------------------+| Contents of fileA | Contents of fileB | | | |+-------------------------+--------------------------+| FileC.txt |+-------------------------+| Contents of fileC || |+-------------------------+[/code]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.txtmy.domain.com/path/fileB.htmlmy.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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.