Creating web design through PHP is basic stuff for website developers. However, there are individuals who are starting on projects that need a simple tutorial on how a website can be built using PHP. PHP is a server-side scripting language that is widely used for web development because it is free with an open source license. As of January 2013, there are about 240 million websites using PHP and 2.1 million servers. However, in spite of its popularity there have been no written specifications for PHP language but the PHP interpreter as de facto standard.
WordPress is a good example of a CMS based on the PHP language. So WordPress sites like uglychristmassweater.com can be edited by the use of PHP plugins or hardcode modifications. This allows the developer to have more control of the website. The Ugly Christmas Sweater website is even equipped with many PHP based plugins that provides different functionalities, but can be further modified with a bit of PHP coding.
Guidelines in using PHP
- One rule of thumb is to ensure that all files related to a specific website are organized into the same folder. This will prevent any dead links or linking errors that may crop up later on when the website becomes large. Another tip would be to keep all filenames created for pages in lowercase.
- Open up the HTML editor and create a new page that can be saved as template.php inside the folder that has been created for the files. Any extensions of the page that have been created has to end with .php and not .html to allow PHP to parse the pages and include the “includes”.
- Individual pages can be created by opening a new blank page in the editor and calling it as header.php. The process is repeated for footer.php and menu.php. These will form the basis for the website before adding color format and style.
- On header.php, you can add text or logo and on the footer.php you can include a copyright notice. The footer.php can also be used to add more links later. On the menu.php, you can add home, about us and contact us.
- On the template.php, you will notice that it is blank and it will remain so. This template page will only be used to create other pages. With this page, open the HTML editor and save the page as index.php as the new main index page.
- Now that the foundation and pages have been created, add text to all the pages that have been created and open up the menu.php again. You now have the number of links and pages that can be added to this file.
- View all the pages that have been created before you upload to the PHP-enabled web server.