Home   CGS 2820C
  Web Development
#15 Grading Criteria for:
Extra Credit: Include files and Server-Side scripting languages such as ASP and PHP.
30 points maximum.

Description: JavaScript and Behaviors (such as Pop-up messages and Swap images) use Client Side scripts to allow dynamic interaction or DHTML on the local client computer.
PHP (.php), CGI, ASP (.asp or .aspx), and Cold Fusion (.cfm) are Server-Side scripting languages for Dynamically created web pages. This Grading Criteria web page was saved as a PHP file so that a small PHP demo could work (notice the .php extension in the URL/Address bar).

Note1: You can view .htm files locally. However, you cannot view .php, .cfm, or .aspx files locally without special software installed on your computer.

Note2: You will need a separate web page for each Server Side scripting language. So perhaps the best and easiest way to do this assignment is do an ASP script, an ASP script calculation, access a database through ASP, and add an Include file to your web page. That is the order of the first four 25 point items shown below, for a total of 100 points maximum.

Note3: This assignment will probably be graded live in class as you take your practice final on the last day of class.

Include file: A server-side file that can be "included" in multiple web pages, so that if the external include file is modified, all of the web pages that contain the include link are also immediately modified. An example might be an include Footer with your contact email and a Last Modified Date script. Another example may be an include Nav bar so that if you add a web page, all the other pages will immediately have access to it through their menu navigation.
Sample code added to the <body> tab for the Include Nav bar: <?php include ("nav.htm"); ?>

PHP Videos

JUST DO ONE OF THE OPTIONS BELOW - I recommend the PHP Include Project:
Make a new folder called PHP, copy all of your files there and follow the directions below.

Topic Directions Points
Add an Include File that works with multiple pages.

Note: you can view .htm files locally. However, you cannot view the results of .php, .cfm, or .asp code locally without special software (such as XAMPP) installed on your computer.

If you open a web page with Include files in your browser and click View Source, the web server will convert all the include lines into pure HTML, so you will not see the php code or true local source code.

Suggestion/Directions:
1. Make a folder on your site called /php
Copy your image folder and all of your files to the new php folder.
Rename all copied files from .htm to .php
2. Copy your navigation code in index.php to a new page and save it as nav.htm
Below is the sample of all the code in the new nav.htm:
<a href="index.php">Home</a>
<a href="Resume.php">Resume</a>
<a href="PFolio.php">Portfolio</a>
<a href="Contact.php">Contact</a>

3. Replace your navigation code in index.php and resumer.php... with
<?php include ("nav.htm"); ?>
4. Upload your files to the php folder
5. Test by going to http://yourDomain/php/
6. Upload to the assignment dropbox the php URL: http://yourDomain/php/
For a online chapter on PHP include files see:
DreamweaverCS4/Powers12PHPincludes.pdf

To see how to add an ASP Include file:
http://www.w3schools.com/asp/asp_incfiles.asp

<!--#include file ="somefilename"-->

See SamplesHTMLcode/IncludeFiles/

In Dreamweaver click Insert | Server-Side Include

Basic Include File Directions:
1. Create your Include File - for instance, build a nav.htm (I suggest you simply copy your Navigation code from your index.htm file and save those few lines in a separate file named nav.htm)
2. Replace your navigation code in index.htm with one of the include calls below:
<?php include ("nav.htm"); ?>     : PHP
<!--#include file="nav.htm"-->    : SHTML
<!--#include file ="nav.aspx"-->  : ASP
<cfinclude template = "nav.htm">  : Cold Fusion
3. Appropriately rename index.htm as index.php or index.shtml or index.cfm (in the end you will rename Contact.htm to Contact.php and replace your nav code with <?php include ("nav.htm"); ?>  and then do the same for Portfolio.htm... (If you use any php code on a web page, you need a .php extension, and the same for .asp, .cfm...)
4. Typically you cannot view server-side script files on the client (local machine) so you will probably have to upload your files to test them.

Up to 30 points
Criteria:
Relevant
Functional
Well laid out

Add at least two include files, such as header.htm, footer.htm, and nav.htm

Create or download a relevant ASP script, upload it to your web server, and confirm that it runs live on your website. 

Modify and customize any downloaded scripts. Also be sure to give credit through comments when required.
File | New | ASPX

The language directive line is placed immediately above the <html> tag. By default it is C# but can easily be changed to VB: <%@ Page Language="C#" %>

Expression Web has a built-in server to manage ASP.net pages.
Up to 30 points
Criteria:
Relevant
Functional
Well laid out
Create or download an ASP script to calculate something relevant to your website. Upload it to your web server, and confirm that it runs live on your website. 

Modify and customize any downloaded scripts. Also be sure to give credit through comments when required.
ASP code begins with <% and end with %>

Reminder: .style1 is not a meaningful name: -5
Reminder: Every page needs a Title: -5
Up to 30 points
Criteria:
Relevant
Functional
Well laid out
Create or download an ASP script to access and update an online database with something relevant to your website. Upload both the database and the ASP page to your web server, and confirm that it runs live on your website. 

Modify and customize any downloaded scripts. Also be sure to give credit through comments when required.
With ASP.Net you can access either a Microsoft Office Access database or a SQL database.

Snippets of gdform.asp script:
<%
Dim landing_page, host_url
Dim fso, outfile, filename, dirname, myFolder
Dim bErr, errStr, bEmpty
Function FormatVariableLine(byval var_name...)
  Dim tmpStr
  tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " START>" &
vbCRLF
  tmpStr = tmpStr & var_value & vbCRLF
  tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " END>"
  FormatVariableLine = tmpStr
end function

Sub OutputLine(byVal line)
outfile.
WriteLine(line)
end sub

if err.number = 0 then...
Up to 30 points
Criteria:
Relevant
Functional
Well laid out
Create or download a relevant PHP script, upload it to your web server, and confirm that it runs live on your website. 

Modify and customize any downloaded scripts. Also be sure to give credit through comments when required.

For PHP Tutorials and details see: http://php.net

See: http://webscripts.softpedia.com

For an online eBook on PHP see:
0ClassFolders/2820Web/eBook-Springer/PHP/

File | New | PHP
Note: unless you have server software installed on your computer, you will not be able to test it on your local system. One solution might be to wait link your new PHP page to your website until it well tested online. Instead of accessing the PHP page from your normal menu navigation links, put a test folder on your website and type the full test folder web address URL to test it.

PHP code starts with <?php
Tap Ctrl + L for PHP IntelliSense inside a PHP block

Below is a very short working PHP example to show today's date.
<?php echo date("m-d-y"); ?>
<?php
echo 'PHP Date Demo
';
echo date("m-d-y");
?>

Up to 30 points
Criteria:
Relevant
Functional
Well laid out
Create or download a PHP script to calculate something relevant to your website. Upload it to your web server, and confirm that it runs live on your website. 

Modify and customize any downloaded scripts. Also be sure to give credit through comments when required.

See:
EW7_PhpDemo.php
EW7_PhpCalcDemo.php
EW7_PhpInputAndCalcDemo.php
Below is a simple PHP calculation routine:

<?php
$width = "60";
$height = "20";
echo "If Height=60px and Width=20px, then area is ";
echo "$width * $height px";
?>


You can install a PHP web server, go to
http://php.net/downloads.php
Up to 30 points
Criteria:
Relevant
Functional
Well laid out
Create or download a relevant Cold Fusion script, upload it to your web server, and confirm that it runs live on your website. 

Modify and customize any downloaded scripts. Also be sure to give credit through comments when required.
hhttp://www.adobe.com/products/coldfusion/



Up to 30 points
Criteria:
Relevant
Functional
Well laid out
Create or download a Cold Fusion script to calculate something relevant to your website. Upload it to your web server, and confirm that it runs live on your website.

Modify and customize any downloaded scripts. Also be sure to give credit through comments when required.
Cold Fusion Tutorials:
http://www.quackit.com/coldfusion/tutorial/
Up to 30 points
Criteria:
Relevant
Functional
Well laid out
Create a PHP folder
images     [Dir]
   contact.php
   favicon.ico
   index.php
   nav.htm
   footer.htm
   portfolio.php
   resume.php
   yourSiteNameLayout.css
  Maximum:
30 points