COAP:COAP-2100/week7: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 26: Line 26:
; Using a web server
; Using a web server
* Short demo of [[Modular Webserver System]], including installation and configuration discussion
* Short demo of [[Modular Webserver System]], including installation and configuration discussion
* To start the webserver, go to the mowes directory and click '''mowes.exe'''. Make sure that no other web server is running. Also shut down applications like Skype that do grab the "webserver port".
* Finding errors with php
* Finding errors with php
** Either look at the log file: ''./apache2/logs/error.log''
** Either look at the log file: ''./apache2/logs/error.log''
Line 32: Line 33:
* Web hosting (demo by a student ?) and file transfer. What's different between a web server on a PC, a web hosting provider, and a server you own.
* Web hosting (demo by a student ?) and file transfer. What's different between a web server on a PC, a web hosting provider, and a server you own.


; Processing forms with PHP (a taster)
; Processing forms with PHP - a few things that you should know
* [[HTML forms tutorial]]
* We shall make modifications to the example discussed in [[HTML_forms_tutorial#Processing_forms_with_PHP|Processing forms with PHP]]
* We shall make modifications to the example discussed in [[HTML_forms_tutorial#Processing_forms_with_PHP|Processing forms with PHP]]
* Make sure to understand that you '''must''' either look at log files or change the PHP configuration if you plan to develop some PHP code and deal with errors.
* Make sure to understand that you '''must''' either look at log files or change the PHP configuration if you plan to develop some PHP code and deal with errors.
** Log file location: '''apache2/logs/error.log'''
** Log file location: '''apache2/logs/error.log'''
** PHP configuration change: Change line 538 of the ''./php5/php.ini file'' to '''display_errors = On'''
** PHP configuration change: Change line 538 of the ''./php5/php.ini file'' to '''display_errors = On'''
** If you change the php.ini file or one of the options in the Mowes control panel, you will have to restart the server.
* Looking at the PHP configuration and the data that PHP will receive:
* Looking at the PHP configuration and the data that PHP will receive:
** Insert the following line of code at the end of your PHP code:  ''phpinfo();'' and look at the ''PHP Variables'' (reload the file and then scroll down to end).
** Insert the following line of code at the end of your PHP code:  ''phpinfo();'' and look at the ''PHP Variables'' (reload the file and then scroll down to end).
; Playing with HTML and PHP
* Make sure that the webserver and the database is started (Modular Web Server icon in the status bar)
* Create a new ''quiz'' subdirectory '''under''' the ''mowes/www''' directory. The web server only will serve contents from this place
* Create two files: '''quiz.html''' and '''quiz-processing.php''' using the example code from [[HTML_forms_tutorial#Processing_forms_with_PHP|Processing forms with PHP]].
** If you are using Kompozer: Copy/Paste into the '''source''' window. Also, you probably need Kompozer 0.8xbeta to edit the PHP file. Else just use a text editor like NoteTab.
* Look at the files by opening the following URL: http://localhost/quiz/
* Make changes to the HTML and PHP and reload.


=== Wednesday ===
=== Wednesday ===

Revision as of 00:35, 21 February 2011

Week 7 COAP 2100

Topics Covered

  • Web server architectures
  • Running a webserver on your own PC
  • HTML5 for information ...
  • HTML forms tutorial (continued)
  • The concept of server-side scripting and web applications

Teaching materials

Classroom activities

Monday

What do we mean by the Internet (part II - web application architectures)
Using a web server
  • Short demo of Modular Webserver System, including installation and configuration discussion
  • To start the webserver, go to the mowes directory and click mowes.exe. Make sure that no other web server is running. Also shut down applications like Skype that do grab the "webserver port".
  • Finding errors with php
    • Either look at the log file: ./apache2/logs/error.log
    • or make the following change to file ./php5/php.ini" on line 538:
 display_errors = On
  • Web hosting (demo by a student ?) and file transfer. What's different between a web server on a PC, a web hosting provider, and a server you own.
Processing forms with PHP - a few things that you should know
  • We shall make modifications to the example discussed in Processing forms with PHP
  • Make sure to understand that you must either look at log files or change the PHP configuration if you plan to develop some PHP code and deal with errors.
    • Log file location: apache2/logs/error.log
    • PHP configuration change: Change line 538 of the ./php5/php.ini file to display_errors = On
    • If you change the php.ini file or one of the options in the Mowes control panel, you will have to restart the server.
  • Looking at the PHP configuration and the data that PHP will receive:
    • Insert the following line of code at the end of your PHP code: phpinfo(); and look at the PHP Variables (reload the file and then scroll down to end).


Playing with HTML and PHP
  • Make sure that the webserver and the database is started (Modular Web Server icon in the status bar)
  • Create a new quiz subdirectory under' the mowes/www directory. The web server only will serve contents from this place
  • Create two files: quiz.html and quiz-processing.php using the example code from Processing forms with PHP.
    • If you are using Kompozer: Copy/Paste into the source window. Also, you probably need Kompozer 0.8xbeta to edit the PHP file. Else just use a text editor like NoteTab.
  • Look at the files by opening the following URL: http://localhost/quiz/
  • Make changes to the HTML and PHP and reload.

Wednesday

Topics (TBA in detail)

  • XML
  • SVG
  • Document formats

Homework 7

Task

Create a PHP program that can process a simple quiz made with radio buttons. In addition, it should include 1-2 text input fields that ask for a name. Start from the example presented in the HTML forms tutorial.

  • You can reuse elements from the JavaScript (hw 6) exercise. You also could relate the topic of the quiz to the term project.
  • You may use questionnaire items from other sources, but do not plagiarize. If you reuse assets from another source, cite the source. Plagiarism is simply not accepted and will be sanctioned.

Note: CS students familiar with HTML forms and PHP can use other HTML forms but be warned that, for example, processing checkboxes is more difficult.

Tips
  • Validate your HTML code
  • Use the server log files for finding PHP errors or keep the following line at the start of your PHP code:
error_reporting(E_ALL);
Evaluation criteria
  • Ergonomics and content (does the quiz "make sense" and is it interesting)
  • User experience (does it look good)
  • HTML and CSS code (is it valid)
  • Style and presentation
  • PHP (is your code running, does it compute ok)
Due
  • Before Wednesday week 8 class
Submission
  • Submit the files (*.html, *.php and if needed *.css, pictures, etc.) to the world classroom