Follow us on Google+

Why You Should Create PHP Powered Websites and How?

PHP :Hypertext Preprocessor is very useful, dynamic scripting language. You can create a simple website to powerful web application with PHP. If you are just beginning to get into web design and development you should consider learning it.

Let’s start with little introduction. PHP (originally stood for personal home page)  is a server side scripting language, which means it resides on the server. You do not have to install PHP on your computer to view PHP scripts. Therefore, it is faster and better to work it. Whereas, if the javascript is disabled on the client computer, they will not be able to view the whatever script it is running on the web page. However, let’s not just assume one is better than the other, but both of them has their uses. You can embed PHP directly into the HTML page or create  separate pages page with PHP extension. You do not even have to be a ninja coder to use the basic PHP functions. If you understand the basic, you can pretty much take it from there.

Why Create Webpage Using PHP?

The best thing I like about PHP is the ability to change webpage content dynamically. For example: let’s say your client wanted ten pages and you coded in the pages in HTML for using the usual header, content , footer layout. So, after you finsished coding all the page, you client says they want to change the logo or header content. You would have to go to individual page and change it. If you used PHP to create the page you would just change the header.php file  and of course you would have to included the header in the all the pages. If you see the example below it will be more clear. You will need to install  MAMP or WAMP to test PHP pages locally. If you do not how here is a guide for Mac and Windows.
You can take look at the demo of the two PHP pages created using the following method

View Demo | Download Files

We will start by creating an HTML page then just change it into PHP. So, here is the HTML layout


<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <title>PHP </title>

 <link rel="stylesheet" href="style.css" type="text/css" media="screen"/>

</head>
<body>
<div id="wrapper">
<div id="header"> <h2>This Header </h2> </div>
<div id="content">
<h2>This is First Page</h2>
</p>
</div>
<div id="footer"> <h2>This footer </h2> </div>
</div>
<!-- end wrapper -->
</body>
</html>

Here is how the PHP files will be formatted

First, we will create header.php. Copy from <html> to  <div id=”header”> <h2>This Header</h2> </div> to a new page and save it as a new page as header.php

Everything between content div will be inside index.php. We can later uses this PHP file to for more pages by duplicating it.

Next, is the footer. This is end of the page.

We need  to to add all this three file into one. To combine this three file we will be using PHP include functions . This function includes one PHP file into another. Here is how we will both header and footer inside the index file:
On the beginning for index.php

<?php include("header.php"); ?>

At the end of the index.php file we add


<?php include("footer.php"); ?>

That is it. We have created our web page with PHP. Now, let’s say  you want to create another page, you can just copy paste the index.php file and change the just the content. If  you wanted to change something in the header, content or footer , you will just make change in the individual files you will not need make changes to each file. This was just most basic use of PHP , if you are planning to extend you knowledge on PHP we will add some links at the end of the post, where you can learn more PHP.

PHP and CMS ( Content Management System)

Most of the famous and well known CMS such as WordPress, Drupal , Joomla are written in PHP. If you wanted to create your own theme for one for these CMS or edit a theme for customization knowing PHP is a must . If you know enough PHP you can familiarize yourself  the codex of these CMS and take it form there.

PHP Tutorials and Resources

Now that we have showed you why you should learn and use PHP,  here are some tutorials and resources to help you extend your PHP knowledge.

Image Credit

If you enjoyed this post, get free updates by email or RSS.

Posted Under: Tips & Tools, Tutorial, Web design

Tagged:

Bookmark or Share This Post

  • Bookmark on Delicous
  • Share on Facebook
  • Share on Stumble Upon
  • Tweet This
  • Float it !


  • http://www.phptrainingchandigarh.com/ PHP Training Chandigarh

    Thanks for grate tutorial.

  • http://www.clippingshop.com Clippingshop

    Great stuff , Yes i to support PHP, even our site is developed by PHP. Thanks for sharing…

  • http://www.brettwidmann.com Brett Widmann

    Great article! I like how you included the working demo. Mine turned out great though. Thanks for sharing.

  • http://r2ntlimewirefreedlz.wetpaint.com/ limewire

    dang nice stuff dude.

  • Pingback: Websites | Mozilist

  • http://www.websitedesignbangladesh.com/ web design

    Why You Should Create PHP Powered Websites and How? – This one is great I found online.

  • Pingback: Absolute Beginners Guide To Easy Cms Website Building. | 7Wins.eu

  • Pingback: Pourquoi vous devez créer un fichier php sites alimentés et comment?

  • http://www.blogsnexus.com osper

    helpfull to understand php anyway its good

  • http://www.mynetbookworld.com Mehmet – My Netbook World

    Hi Ali,

    It was a nice introduction for me to PHP it helped much. Thanks! Also, keep going good work, you and your blog is getting better day-by-day.

    Mehmet

  • Pingback: de la red – 5/04/2010 « Tecnologías y su contexto

  • http://www.jordanwalker.net Jordan Walker

    PHP is an excellent choice for building server side dynamic websites. Great article.

  • Pingback: CSS Brigit | Why You Should Create PHP Powered Websites and How?

  • Christian

    You can do the same with Python and a template engine, but Python as a language is engineered carefully in contrast to PHP. And of corse a Python environment is dynamic too.

  • Pingback: Perché si dovrebbe creare siti Web PHP alimentato e come?

  • Pingback: The Essential Selection of Weekly Design Links No.11 « Web Design Mash

  • Pingback: The Essential Selection of Weekly Design Links No.11 « Web Design Mash

  • Pingback: ¿Por qué debería crear sitios web php potencia y cómo?

  • ItsNotYouItsMe

    Dude, the following syntax is better, because in fact include is not a standard function, so parenthesis are unnecessary.

  • Pingback: Webby Scripts Why You Should Create PHP Powered Websites and How?

  • http://www.fallingsquirreldesign.com Jordan Wiedbusch

    Thanks for the great article. I’ve been looking around for some more PHP resource so I’m going to be check out all of those links.

  • http://Connectmadera.com Joe A.

    Thanks for your post I think I know the basics of php. Thanks for all the links at the end. I need to learn more about php.

  • Pingback: Why You Should Create PHP Powered Websites and How? | Neorack Tutorials

  • Pingback: You are now listed on FAQPAL

  • http://sochi.aelita.su/ Svetlana

    really helping article it’s very useful especially for a beginner like me, thanks!

  • Larry

    I’m pretty good with PHP, but I’m bad with being creative.. You know, creating clean layouts with photoshop and so on.. I always thought you can’t be good in both..

    • http://desizntech.info Kawsar Ali

      Well, its not about being good in both. I think if you just know enough, perhaps the basic syntax it can be very helpful.

    • AgungX

      same as like u dude,. i have a little bit problem with sotoshop

  • http://almobdaa.com ahmed

    thanx for the tut very good

  • http://webbanshee.blogspot.com WebBanshee

    This is very useful : ) I am new to php and just starting to understand the advantages.

    Very good, thank you

  • Pingback: uberVU - social comments

  • http://tookooldoggies.blogspot.com Elena

    You have really brought the wonders of PHP to the forefront and have simplified it for those of us who need more help in learning code. Thanks for such an informative and easy to understand post. :)

    • http://desizntech.info Kawsar Ali | DT Admin

      Yap. I do really enjoy working with PHP. I still got a lot to learn though.

Quick Links




Our Supporters