|
Staff
|
PHP/Ajax Lab DayDecember 2, 2010 and December 7, 2010 SetupIf you haven't done this previously: Create a new directory ~/public_html/cs312/labs for your lab exercises and set the permissions so that it the web server (anyone) can access it (chmod 755 ~/public_html/cs312/labs).
Create a new directory Make sure that you set the permissions on the HTML, JavaScript, and CSS files to SubmissionAs you complete each lab exercise, let me know and I'll come check it out. Debugging
Lab Exercises1) XML DisplayDownload the file books.xml to Write XHTML and JavaScript code to display a table with the author, title, genre, and price fields of all items in the XML file. Hint: See the plant-table.html example from the XML lecture (see slide 43). 2) Write to the XML fileWrite XHTML and PHP code to add the following entry to the XML file when the user presses a button: book: id="bk112"
Note: See the SimpleXML reference to find out how to add the attribute for the book. Reminder: To call a PHP script directly from an XHTML form, use the Hint: See the example starting at slide 28 in the PHP/Ajax lecture. 3) Searching an XML fileWrite XHTML, JavaScript, and PHP code to implement a type-ahead box that displays all books by a particular author. Steps:
Note: See the XPath reference for more information on searching XML files. See the XPath Functions reference for more information on how to select strings using XPath. Hint: See the suggest.html example from the PHP/Ajax lecture (slide 34) |