PHP and Web Design

Note 1: You don't have to know PHP programming to do this tutorial.Note 2: I assume that your server supports files with .php extension. If not, you won't be able to do this tutorial. For more info on how to install PHP on your PC go to Php.net

Purpose of this tutorials is to teach you how to design a website that is easily modified or updated. If you have a website with ten pages, updating should not be a problem. But how about if you have more pages..? Here comes the help of PHP. Of course it could be done with other programming languages like .asp, .jsp etc, but personally I prefer PHP. I guess you noticed that from the extension of my pages.

The point I am trying to make is, you can have your menu in one page for example and display it in every page of your website. When you want to change something in the menu, you have to edit only one page, and it automatically changes in other pages. Because you only link from other pages to menu page. Let's start with the tutorial.

1. Open Notepad and type the following as shown below

Save it as header.php

2. Create new file in your notepad and type the following

Save it as main.php

3. Create one more new file and type the following

Save it as footer.php

What we have done here is, we created three different .php files namely: header.php, main.php and footer.php. Later we will be linking them together within a page to create one whole page. Basicaly header.php should include all the meta tags and top menu. And main.php should include all the body content. As for the footer.php it will include Copyright notes and other content like bottom menu.

4. Next we link them together. Open another new file in your notepad and type the following. This is how the linking in PHP done.

Save it as index.php. All pages should be in the same folder. Otherwise the linking won't work. Now access the index.php through your webserver. You should be able to see the following page.

Now change the contents of each page with respective content, I have tried to make it as simple as possible and not to put so much codes inside the html, so that you won't get confused. Because once you know how it is done, you can replace the contents yourself with complicated codes such as tables, javascript, CSS etc. So if you have 100 pages and you have to change your Top Menu link, you don't have to go to every page and change it manually, just change it in header.php and it is done! Good Luck!

Related Articles

  • Discover How To Make Your Web Design Easier
    Whenever I thought of web design my face would frown, I just hated the fact that I had to do any kind of web design. I just couldnt see why web design was simple for other and not for me.
  • Discover How To Make Your Web Design Easier
    If you are a complete newbie in web design looking for ways how to start a site, this tutorial is just or you. Its basic, but useful.
  • The purpose of design
    Now you have a good idea what goals you want to achieve. There is another type of goal, which is the goal of the design process itself. What is design for? At the highest level, the purpose of design is: To enable communication between the consumer and the content Of course, the goal...
  • Introduction to Graphic Design
    If you are going to go into practically any form of business, graphic design is something you are going to become familiar with quickly. Here is a primer.
  • Design like no-one's watching
    Web designers frequently suffer under the illusion that other people look at their web pages the way we do. This is wrong. Designers need to develop the skill of looking at their designs through na
  • Designing for the web
    The purpose of design is to facilitate communication between user and content. Designing for the web means designing sympathetically with the way people actually use the web, not how we think they should. People approach web sites in very different ways to how we design them...
  • 6 Must-Haves on a Website Design
    Designing a website is a tedious and critical work. There are just too many considerations that a web designer should take into when designing a site.
  • Simple Design
    Simple web design delivers huge benefits to designer, client and user. When a design doesnt seem to work, ask what should be taken away before asking whats missing.
  • Functionality Vs Stylish Design
    The question faced by all web designers at sometime during a project is: How much functionality should I sacrifice for stylish design? I know that I have played this balancing game many times. However there is a way to have both in healthy servings...
  • The Ideal Web Design Firm
    Choosing a web design firm isnt as easy as you think it is. Sure, you could get a firm to do your requirements and specifications as long as you have the money to pay for it. However, getting an inexperienced web design firm may hurt you more and oftentimes...

Contact Web Design Outsource and get started today

Need Website Designing, Development, Redesigning, Maintenance and SEO services or help growing your company's web presence? Request a free Quote Now.