WebDesignerTricks First PHP Website

How to Create a Website using PHP

Creating a website is really interesting and fun loving task. Whether you have a small website or large website, you need some basic knowledge of PHP, CSS, HTML, Java Script and JQuery.

Читайте также:  When then return java

If you don’t have good command on these languages, you can still create your own website using this complete tutorial. We assume that you have some basic knowledge of PHP & CSS programming languages as previously said.

In this tutorial, we will show you how you can easily create a website using PHP.

Step-1:

Create a folder and name it “my_first_php_website”.

Step-2:

Create following folders in your “my_first_php_website” folder.

“images”, “includes”

Step-3:

Create following folders in “includes” folder.

Step-4:

Create following files in “my_first_php_website” folder.

-> “index.php”, “header.php”, “footer.php”, “sidebar.php”, “nav.php”, “404.php”, “about.php”, “functions.php”

Create following file in “css” folder.

Put your website logo in “images” folder.

-> “my_website_logo.png”

Step-5:

Now follow step by step tutorial to create your first website using PHP.

Step by Step Guide for Creating a Website using PHP

1) Setup folders and files structures

Just create the same structure as shown in below snapshot and previously described in Step-1, 2, 3 & 4.

How to Create a Website using PHP

Following are the files and folders in my_first_php_website folder that are required to run a website.

Here index.php is the main and first file for our PHP website.

How to Create a Website using PHP

2) Create a sample code for the website

Now, choose your favorite PHP editor and open index.php file. We will use following code for creating index.php file.

Once you become familiar with PHP & CSS, you may create your own code as per requirement.

Create “index.php” file.

Heading1 — Type here First Heading

Heading2 — Type here Second Heading

Heading3 — Type here Third Heading

Heading4 — Type here Fourth Heading

Heading5 — Type here Fifth Heading

First Paragraph

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Second Paragraph

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Third Paragraph

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Now we need to create some more files to complete “index.php” file. We have to add some links in nav area and some text in the content area, sidebar and footer.

Create “nav.php” file.

Create “header.php” file.

Create “functions.php” file.

Create “sidebar.php” file.

Just like above you can easily create “about.php” and “404.php” file.

We need to create a style.css file for decorating the website.

Create a “style.css” file.

/** * GENERAL —————————-*/ body < background-color:#f1f1f1; font-family: Constantia, Georgia, "Times New Roman", Times, serif; font-size: 15px; color:#333; margin:0; padding:0; >#wrapper < width:1020px; background-color:#f8f8f8; margin:0 auto; border-left:1px solid #ccc; border-right:1px solid #ccc; >#header < width:1020px; height:135px; margin:0 auto; margin-bottom:25px; border-bottom:1px solid #ccc; border-top:1px solid #ccc; >#header h2 < font-family: Constantia, Georgia, "Times New Roman", Times, serif; font-size: 18px; padding:10px; >#nav < width:1020px; height:40px; border-bottom:1px solid #ccc; >#nav a < display:inline; padding:10px; text-decoration:none; background-color:#f1f1f1; >#nav a:hover < background-color:#C0C0C0; height:80px; >#content < width:685px; float:left; padding:10px; >#sidebar < width:250px; float:right; margin-bottom:25px; >#sidebar a < text-decoration:none; >#sidebar a:hover < background-color:#C0C0C0; height:80px; >#sidebar li < list-style:none; >#footer < clear:both; width:1020px; height:80px; border-top:1px solid #ccc; >#footer p

Now after taking all the elements from different PHP files, the final HTML file should look like below one.

Following is the complete HTML file after adding all the elements from PHP files.

WebDesignerTricks First PHP Website

HomeAbout UsContact US

Heading1 - Type here First Heading

Heading2 - Type here Second Heading

Heading3 - Type here Third Heading

Heading4 - Type here Fourth Heading

Heading5 - Type here Fifth Heading

First Paragraph

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Second Paragraph

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Third Paragraph

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

  • Home
  • About Us
  • Contact Us
  • First Link
  • Second Link
  • Third Link
  • Copyright © 2014 WebDesignerTricks First PHP Website

    Following is the complete PHP file after adding all the elements from PHP files.

    Heading1 — Type here First Heading

    Heading2 — Type here Second Heading

    Heading3 — Type here Third Heading

    Heading4 — Type here Fourth Heading

    Heading5 — Type here Fifth Heading

    First Paragraph

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    Second Paragraph

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    Third Paragraph

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    Must Read:

    I hope you liked this article, please share your thoughts and feedbacks in comment section.

    Источник

    Create an index file with php

    I’m sure there’s something i’m missing here or doing wrong, I did my best to work up as close as i could, any insights or suggestions would be grea…

    Recent Comments

    Wow, exceptional and complete

    What if the target machine requries port?

    One snag with the docker install of plex. For

    How to fix Ubuntu/Debian apt-get 404 Not Found Package Repository Errors (Saucy, Raring, Quantal, Oneiric, Natty…)

    How to setup a WordPress PHP site with Nginx, PHP5-FPM, and MySQL using Ajenti V with working Permalinks

    How to move Plex metadata and index data to new drive/partition and/or directory location

    Tutorial How to build the Ultimate Bootable Custom USB Flash Drive with Multiple ISOs for Windows, Linux, Etc, and PortableApps for Windows Desktop.

    How to obtain root, install and run XBMC on D-Link Boxee Box

    Samsung Galaxy III (S3) GT-I9300 JTAG Leaked Document. How to repair soft bricked Galaxy S3.

    Git’n Busy

    Tags

    Code and Tech Junkie

    How to create a well structured website using PHP and include function (1 header and footer file)

    In this example i’m going to show you how to create a very simple and easy website using PHP and the PHP Include function. This is a great way to create your website because you only need to have one header and one footer file! This is how i structure almost all my websites because think about it, if you need to change an image, a link, or even a typo, if you are using regular HTML files you have to edit each one individually! This will show you how to save yourself a LOT of time!

    First thing you will need is a host, if you do not have one you can get a free account from Host Tornado at http://www.hostt.net.

    If you don’t want to get a host online you can always download WAMP for Windows or LAMP for Linux and test everything on your machine first.

    Here’s what we’re going to do. We are going to create an index.php file that will pull information from other files that are stored on your server. The end user (person browsing your website) will only see the index.php file. We will specify what page we are looking for by using a little bit of easy php. Ever seen a site who’s website was www.mysite.com/index.php?page=contact? Well that’s pretty much what we’re going to do, with a few twists.

    So first thing first, we need to create a new index file. We will call this file index.php because when you go to www.mysite.com it will automatically go to the index.php or index.html file. Since we are creating our website in PHP we will be using index.php.

    So next thing to do is to create what i like to call our “includes” files and folder. You will understand this term later on in this tutorial but we use the php function include so that’s why we call it that.

    So create a new directory in the same place you have your index.php file and name it anything you would like. I will be using “includes” as my folder name for this example.

    Now that we have our new folder we need to create our new includes files. For this example we will be creating a very simple website that will consist of 3 includes files, header.php, footer.php, and contact.php. Create all three of these files under the folder we just created “includes”. All the files will be blank and that’s fine we will come back to them in a few minutes.

    Now we need to open up our index.php file and start some coding!

    Источник

    Оцените статью