CS 312 - Internet Concepts
Fall 2011: Tues/Thurs 3-4:15pm, Dragas 1117 |
Staff
|
PHP/Ajax Lab DaysNovember 17-22, 2011 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) Setup - XML DisplayCopy books.xml and the HTML file used to display the XML table from your XML lab folder. If you haven't done so yet, complete the XML Lab before continuing. 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="bk114"
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?. When you submit the form, it will take you a new page with the output of the PHP script. You may want to have the script output a link back to your lab HTML page so that you can see the updated table. 3) Searching an XML fileWrite XHTML, JavaScript, and PHP code to implement a type-ahead box that displays all books in a particular genre. 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) |