PHP for designers
Web page
PHP (PHP Hypertext Pre-processor initially PHP Tools, or Personal Home Page Tools) is an interpreted programming language, originally designed for creating dynamic Web pages. Interpretation is used mainly in server-side (server-side scripting) but can now be used from a command line interface or creating other types of applications including GUI using Qt or GTK + libraries.
PHP has several uses such as creating social networks, libraries and other applications that have been termed as Web 2.0. As web page designers that have no need of a database, sometimes we do not understand how creating PHP pages can lighten our load. I’m going to demonstrate the advantage of creating a website using PHP, how to create them and how to make updating easier.
Step # 1
First, create a sketch of the layout of the page. We must identify where are we going to put links, content, header, and so on. Then identify which parts will be repeated in each of the web pages and the parts that are going to change. This is done so that when we create the PHP the pages will be properly divided.
Step # 2
Create the xHTML and CSS for the page and be sure that it is fully functional. Try it on all browsers and validate your XHTML and CSS code. Be sure to validate to avoid any headaches in the future.
Step # 3
This is where you begin to convert your xHTML into PHP. Divide the code of the header, navigation, content and footer in different documents. For example, if the head is first copy the code from DOCTYPE to where the code ends of the head. Do the same with the other parts. Each document will be saved with the extension PHP. Here is an example of how to divide your xHTML.
Step # 4
Once you finish making the divisions, you must instruct the document to look for other PHP content in order to recreate the webpage. This is done with a simple line of PHP<? Php include ( “Name-of-file.php”);?> This line is placed in the order in which the content will appear. For example, if the page is split like the previous example then you should write:
<? php include ( “header.php”);?>
<? php include ( “nav.php”);?>
<div class=”content”>
<h1> Hello World </ h1>
<br/>
<p> Hello </ p>
</ div>
<? php include ( “footer.php”);?>
To verify that everything is working put all the files on a server that can interpret PHP. Now this process will facilitate the work because if you have, say about 16 web pages and you are going to add a page, then you would add a link to each of the 16 preceding pages, whereas with this system, just to make the change in the navigation PHP and it will be reflected in all the pages you have created. Bear in mind that the links should point to the PHP page (ex: index.php, about-us.php, etc. …). I hope that with this article, you can see and understand the value associated with creating a websites using the PHP “include” function. Any questions or comments you can write a comment. Thank you and good luck.
Written by: Juan Rivera



