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

  Evaluating an ecommerce website

Create a check list that contains key point for evaluating an ecommerce website - Write a short, reflective report about website

  Gpc and runtime magic quotes

Create a script that lets you know whether Zeus or Helios has the GPC and Runtime Magic Quotes turned on or off. The output should have appropriate labels that define what output signified and should display 'ON' or 'OFF' depending on the setting.

  Creating functions through conditional operator

Use the conditional operator and the cal_days_in_month function, determine the number of days in the current month and output to browser whether it is normal month or a leap month.

  Web development projects with database

Since the vast majority of web-development projects involve a database, do you think that computational activities should be performed there, or do you think they belong in the XML page or stylesheet?

  Comparing shelf software packages

Required assistance with comparing and contrasting two main off the shelf software packages that could be implemented in an organization.

  Web based scams

Web phishing, pharming and vishing are popular web based scams. Talk about currently used tools and recommended measures to defeat this kind of attacks efficiently?

  Explanation of contextual links

The most powerful hypertext capabilities is the the contextual link. Wikipedia . com is a great example of a site that utilizes contextual links.

  How architectural and protocol changes occur

Discuss how architectural and protocol changes happen, the administrative organization that oversees the technical development of the Internet,

  Traditional approaches for training professionals

Webinars and other web conferencing techniques have proved most beneficial for the provision of affordable quality corporate training.

  Internet for business

Discuss how can a business use the Internet and give at least three examples with web links demonstrating your answer.

  It influences the behavior of organizations

Information technology influences the behavior of organizations. Name one effect of Information technology implementation and long-term usage you suppose having a positive contribution and one having a negative consequence.

  Importance of a guided navigation system

Explain the use and importance of a guided navigation system and shopping cart for a website designed for e-commerce and business purpose.

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