Syllabus Schedule Project Labs Canvas Server Access phpMyAdmin Assignment 1 Assignment 2 Assignment 3 Assignment 4 Assignment 5 Assignment 6 Assignment 7 Assignment 8 Assignment 9

Assignment 1 - Server Side Includes & PHP

Since the emphasis of this course is server-side programming you may copy the HTML/CSS from the working samples to use in your MIS 314 assignments. Remember that all server-side code must be your own work.

You will be creating several files for each assignment. I suggest creating separate folders on the server for each assignment, giving the folders names like A01, A02, etc. The files names for each exercise should be the same as those specified in the assignment.

Submitting assignments:

  • Please carefully follow the submission instructions at the bottom of each assignment. Assignments not submitted correctly (not sent to the correct email addresses, incorrect URLs, etc.) are subject to penalty.
  • File and folder names should not contain spaces.
  • The most reliable way to assure that links are correct is to cut-and-paste the URL from your browser into your email.
  • List the links in the correct order.
  • Assignments will be graded within a few days of the due date. Please check your assignment grades. Any grading problems must be brought to my attention within one week of receiving the email.

1. HelloWorld.php -- This exercise will familiarize you with the Netbeans IDE. You may look at and modify the HTML and CSS used in the samples on all MIS 314 assignments.

  1. Open Netbeans project: Create a new Netbeans project as described in First-time Netbeans Setup if you have not already done so.

  2. Create folder Create assignment folder: Under the Projects tab, right-click on Source Files, and create a new folder named A01 for assignment 1 files (web folder and file names should not contain spaces).

    If you do not see a "new folder" option in Netbeans create a new file and in the dialog box specify a new folder name (click image on right for example). Netbeans will then create both the file and folder.

  3. Create PHP web page: Right-click on the A01 folder and select new PHP web page.

  4. Name the page "Hello". Note that Netbeans adds the .php extension automatically. Click finish.

  5. Create an external CSS file: Right-click on A01 and select new Cascading Style Sheet.

  6. Link CSS to php page: Add a link tag to the php page that links to your style sheet (look at the code in the sample if you are unsure of the syntax).

  7. Define styles: Define at least two styles in the CSS stylesheet. Netbeans should be providing smart-code completion.  Save the css file (Ctrl-S).

  8. Write HTML: Add some HTML and text to the php file that utilizes your styles. Netbean's smart-code completion should be able to see the styles in your style sheet.

  9. Format: When your HTML and php code is getting messy right-click in the editor and select "Format" for auto-formatting.

  10. Add PHP: Add the following snippet to your php page:

     <?php
        for ($i = 0; $i <= 10; $i++) {
            echo "Hello world. Value of i is $i <br />";
        }
     ?>

 

2. Lion.php -- This assignment uses PHP's include statement to insert one file into another file. The include statement is useful for reusing both HTML and PHP code. The syntax is:

<?php include('header.html');  ?>

where 'header.html' is a separate file. The included file will be inserted at the location of the include statement. The extension of the included file is not important since it will become part of the parent PHP file. If you use an IDE like NetBeans to create the include file you may need to remove extra page-level tags such as <html><head>< body> etc. See W3Schools PHP Include file tutorial for more detail.

The exercise uses include files for the header, footer and left menu. The body of each page should have a different picture (you can use the photos in the example or your own pictures).

Tips:

  • You will create six files for this assignment: Lion.php, Giraffe.php, monkey.php are content pages. They will use include statements to insert the header, footer and menu.

  • header.html, footer.html and menu.html contain only HTML.

  • Use your browser's "view source" to see the HTML in the sample.  You may copy the HTML from the example or create your own. Restore Files

 

3. ClockLoop.php -- Modify the example Clock.php ( source) to display the clock 10 times. Put the For statement where you want the loop to begin and the closing curly bracket at the end.

 

Tip on Restoring Files: If you accidently delete a file or folder on Yorktown you may be able to restore it from a backup. Yorktown automatically creates a backup of your files four times each day at 6 am, noon, 6pm and midnight. To restore a file right-click on the folder that you want restored and select "Restore Previous Versions" (see image at right). More: How to restore lost or deleted files.


Submission instructions: Submit assignments via the Canvas course management system. Submit the full URL for each exercise in the assignment, listing the URLs in the same order that they are listed in the assignment. To minimize typos in URLs it is strongly recommended that you copy the URLs from the address bar of the browser rather than trying to type them. Incorrect URLs will not be graded and no credit will be given.

When pages are connected via navigation (as in your Bookstore project) it is only necessary to submit the URL of the first page.

Regular Expressions HTML Color Names Color Picker ASCII Character Codes Unicode Character Codes