Make sure you upload to the public-html folder

Assignment Help Web Project
Reference no: EM131917206

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 <head>...</head> 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:

<?php include(‘header.inc'); ?>

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

<?php include(‘footer.inc'); ?>

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:

<title>My Web Page</title>

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

<title><?php echo $title; ?></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:

<?php if(empty($title)) $title="My Web Page"; ?>

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:

<?php

$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

Reference no: EM131917206

Questions Cloud

Put option contract on apple with strike price : You purchase a put option contract on Apple with a strike price of $120.
Why the facts are important to consumer identity : Type a one-page Fact Sheet that explains in detail three interesting facts about age-Subculture and why the facts are important to Consumer Identity.
Prepare comprehensive personal income tax returns : Using a tax preparation software - preferably the Profile software that is provided free of charge by Intuit Canada to students of this course - and the facts
What is the maximum gain from the strategy : What are three ways to terminate an option position? What is the maximum gain from the strategy? What is the breakeven from this strategy?
Make sure you upload to the public-html folder : 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.
Evaluating different cookie-baking ovens : You are evaluating two different cookie-baking ovens. If your discount rate is 13 percent, what is each machine’s EAC?
Provide bespoke communications and content marketing : On top of that, its established Custom Publishing unit provides bespoke communications and content marketing solutions to major corporate clients.
What suggestions would you make and why : Your roommate is about to submit a scope statement for a spring concert sponsored by the entertainment council at Western Evergreen State University (WESU).
Precipitate of magnesium fluoride : Will a precipitate of magnesium fluoride form when 200.0 mL of 1.9 x10^-3 M MgCl2 are added to 300.0 mL of 1.4 x10^-2 M NaF?

Reviews

Write a Review

Web Project Questions & Answers

  Create a web page that will give information

Create a Web page that will give information about each of the positions a site specification - Salaries, benefits associated with these positions

  Create the formstxt css sheet and apply it to the page

Create an entry field for:Create the formstxt.css sheet and apply it to the page. Use local tags on the page to override the .ccs and set the size of the font for "Student Information" to 16 pt.

  Prepare a narrative that describe site to prospective client

Create a narrative that describes the site to your prospective client. Create a storyboard diagram depicting the layout of your Website. Create a Cascading Style Sheet (.css) for all pages.

  Create a footer that contains a copyright statement

Create a footer that contains a copyright statement like the one shown below where the current year should be extracted by using date class

  How does a web service differ from a web application

How does a web service differ from a web application? What are the steps involved in defining and using a web service? What are the elements of the web services software stack and what is the purpose of each?

  What are the steps you have taken to maintain site

What are the steps you have taken to maintain and redesign your site over the past several weeks. How is the process that you followed similar to or different from how sites are maintained and redesigned in the professional environment

  A video store (avs) runs a series of fairly standard

A Video Store (AVS) runs a series of fairly standard video stores. Before a video can be put on the shelf, it must be cataloged and entered into the video database. Every customer must have a valid AVS customer card in order to rent a video. Customer..

  Create a web site for local service agency

You will work with a partner and select one local service agency from among several for which to create a web site.

  Build a meanstack website

Open the zip in the webstorm, and run 'www'. The website should be shown on the localhost: 3000, Build a meanstack website within node.js, angularjs.

  Xslt elements that provide conditional processing

What are the two XSLT elements that provide conditional processing ? Describe how the functionality provided by these two elements differs.

  What is the process used to add content and publish website

What is the process used to add content and publish the website in your workplace or another organization? How can this process be improved

  Create website prototype for tee-shirts sales using html

Create a 3-page website prototype for tee-shirts sales using HTML 5, CSS, and JavaScript languages. Ch. 8 of Programming With Mobile Applicationsdiscusses a variety of web development tools. All program files should be in a ZIP file for submission..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd