- How to Create a Website using PHP
- Step-1:
- Step-2:
- Step-3:
- Step-4:
- Step-5:
- Step by Step Guide for Creating a Website using PHP
- 1) Setup folders and files structures
- 2) Create a sample code for the website
- Create “index.php” file.
- Heading1 — Type here First Heading
- Heading2 — Type here Second Heading
- Heading3 — Type here Third Heading
- Heading4 — Type here Fourth Heading
- First Paragraph
- Second Paragraph
- Third Paragraph
- Create “nav.php” file.
- Create “header.php” file.
- Create “functions.php” file.
- Create “footer.php” file.
- Create “sidebar.php” file.
- Just like above you can easily create “about.php” and “404.php” file.
- Create a “style.css” file.
- Following is the complete HTML file after adding all the elements from PHP files.
- WebDesignerTricks First PHP Website
- Heading1 - Type here First Heading
- Heading2 - Type here Second Heading
- Heading3 - Type here Third Heading
- Heading4 - Type here Fourth Heading
- First Paragraph
- Second Paragraph
- Third Paragraph
- Navigation-1
- Navigation-2
- 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
- First Paragraph
- Second Paragraph
- Third Paragraph
- Must Read:
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.
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.
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.
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 “footer.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 USHeading1 - 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.
Navigation-1
Home About Us Contact Us Navigation-2
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.