Ask E-Commerce Expert

Lab Assignment

In this lab, you will use dynamic content to make every web page on your website have the same appearance. To do this, every web page must be divided into three sections: header, content, and footer. The labs leading up to this have been designed to push you to separate your content from the other sections of your web page, so you should be ready.

• Don't confuse "header" with the ... section of your HTML - those are two completely different things

• Don't think that you need to go in and add a div with id='header' and a div with id='footer' - your header and footer are conceptual divisions

Step 1

Pick one of your web pages to get started. Pick the one that is most cleanly divided into a header, content, and footer. I'm going to assume you picked the index.html file, so every time I mention that you should do something with index.html, use the file you picked, which could be products.html or contact.html or rollotookus.html...

Copy the index.html file and give the copy the name header.inc (please use that file name because the auto-grader will be looking for a file by that name - even though you could use ANY name, the autograder isn't smart enough to look for other file names).

• If you copy it on your personal computer, you will need to upload it when you are done with it

• If you SSH into the server and you want to copy it, the command is: cp index.html header.inc

Edit the header.inc file. Scroll down to the first line of content and delete all of the content and everything below the content. All that the file has left is your header. Save the header. You are done.

Step 2

Repeat step one, but for the footer. Copy index.html to footer.inc. Edit the footer.inc file. Delete everything down to the end of the content. Save the footer.inc file.

Step 3

Edit the index.html file. Delete everything down to the start of the content and replace it with:

Next, delete everything after the content and replace it with:

Your index.html file should now have the header include, your content, and the footer include - nothing else.

Important note on copying and pasting: Text editors mess with quotes. So, if you copy and paste from this document, the single quotes will actually be curly quotes. PHP uses single quotes and double quotes. It does not use curly quotes. So, you will get a syntax error. PHP will see those curly quotes and have no clue what you are trying to do. Therefore: Type the code by hand! Don't copy and paste!

Step 4

If you are working on your personal computer, upload your work to the server. Make sure you upload to the public_html folder and not your home folder.

If you did your work on the server itself, skip step 4.

Step 5

You should see your complete web page. Use the "view source code" option in your web browser. Notice that you have HTML without any PHP. You have the output of the PHP program you wrote.

Step 6

Repeat for the rest of your web pages. You may run into issues because some pages (like your orders page) have extra code. It is save to include extra code in all pages. It just won't get used.

Every web page should now have an identical header/footer. Many students have minor differences from page to page. For example, the page you are on is highlighted in the menu. The title changes from page to page. The logo is larger on the home page than the rest of the pages. Etc...

The following is an example of how to change the title text per page. You do not HAVE to do this. It is extra. You can use this example to work out how to make other changes as well - such as only including your order validation script on the orders page.

In your header.inc file, your title should look something like:

My Web Page

Replace the actual title with a variable. The name of this variable will be title:

<?php echo $title; ?>

In PHP, $ means "this is a variable." So, $title means "the variable named title." The echo command simply means that we will print the variable value. You can use print instead of echo if you like.

Right now, $title doesn't have a value. So, at the very top of your header.inc file, we will check to see if it has a value and, if not, give it a value:

The function "empty" returns true if $title is not set, is an empty string, or is false. So, if it is not set, we give it a default value. Then, when it is printed in the title section, it will at least have the default value.

Now, assume I have a products.html page and I want to use a custom title. I add a line directly before I include the header.inc file:

$title = "Products:My Web Page";

include(‘header.inc'); ?>

It may seem confusing that I'm setting the value of $title in my products.html file, but using it in the header.inc file. Don't think of them as separate files. From the point-of-view of PHP, it is one long continuous file.

Now, you can customize the title from page to page. You could also do other things. For example, what if on my orders.html page I included the variable: $include_validation_script = true;

Don't be overly concerned with if-then-else statements or creating and using new variables. We will get into that next week.

Attachment:- Website-1.zip

E-Commerce, Computer Science

  • Category:- E-Commerce
  • Reference No.:- M92755869

Have any Question?


Related Questions in E-Commerce

Purpose of the assessment with ulo mapping students are

Purpose of the assessment (with ULO Mapping) Students are required to design and develop four different Apps. Students will be able to: b. Apply Java programming concepts, models/architectures and patterns to Android app ...

Research and discuss html 5what are its main featureswhat

Research and discuss HTML 5. What are its main features? What resources are available to support it? Put it in your own words please.

Html - css assignments assignment 1 - internet programming

HTML - CSS Assignments Assignment 1 - Internet Programming   My grandfather, like many men who lived in rural America, owned a large machine shed where he stored tools, farm equipment, vehicles, lumber, and wonderful gad ...

Mobile applications assignment - an ios recipe application

Mobile Applications Assignment - An iOS Recipe Application - Introduction - In this assignment, you will create a simple Recipe application for iOS using Xcode (Swift). This application allows users to view food recipes. ...

Secure electronic commerce assignment -part a -based on

Secure Electronic Commerce Assignment - Part A - Based on your practices in labs, develop an online e-commerce (shopping) system using html, javascript and php. You can assume any products for sales. Please create a fold ...

Overviewassignment 2 asked you to build the front end of

Overview Assignment 2 asked you to build the front end of the assignment, now the client wants you to build the full eCommerce website to the point that orders can be made and stored in a spreadsheet. Requirements 1. Web ...

Create testcase for given project first use piki design to

Create testcase for given project, first use piki design to do test case Want to do it like testcase one file and you can also get right information from saeed testcases Want to piki design all of it and informat like te ...

Assignment requirementsyour web site proposal and

Assignment Requirements Your web site proposal and presentation (Assignment 1) was accepted, subject to any feedback you may have received. You company has been asked to develop website you suggested and build the featur ...

Mobile web application development assignment - android

Mobile Web Application Development Assignment - Android Apps Development Purpose of the assessment - Students are required to design and develop four different Apps. Apply Java programming concepts, models/architectures ...

Assignment - creating dynamic websites and web-based

Assignment - CREATING DYNAMIC WEBSITES AND WEB-BASED APPLICATIONS - AN OVERVIEW This assignment is an overview of the concepts, technologies and design techniques required to build dynamic websites and web-based applicat ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As