Tutorial
Introduction
As you could see in the previous tutorial, you can display text by using the echo command.
You might already see where this is going, to create a website layout you will need a language like HTML or XTML.
But if you entire file is a PHP file, how can i add HTML or what ever language you prefere to my page?!
In this tutorial we will explain how you can display your website by using PHP.
Step 1
Before we start creating our first HTML page with PHP you will need a PHP file running on the webserver, the name of the file does not matter.
Open the file and make sure you already have the start and end tag in the file:
Code:
<?php
?>
Step 2
Assuming you understand how HTML works we will now echo the basic tags of HTML in the file you just created. This way PHP will write the text to your source code and the browser will see that you are using HTML.
The browser will work exactly the same as if you would be using an HTML file.
Code:
<?php
echo "
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<title>Hello world!</title>
</head>
<body>
Helloo people, this is my first PHP based website!
</body>
</html>";
?>
In this code you can see we have created a very basic HTML page which outputs: Helloo people, this is my first PHP based website!
It works like this with all HTML / XHTML you would like to display.
|
This was lesson 2, you now understand you can use all sorts of languages like HTML / XTML and many other languages inside your PHP to display your HTML layout.
| « Previous | Next » |
Comments
Sillentkil - 2008-11-18
hey hier kunnen comments
bij je note, Example: style="width:150px;". beetje raar voorbeeld
Example: echo "<td width=\"5%\">";
Example: echo "<td width='5%'>";
verder leuke tutorials
bij je note, Example: style="width:150px;". beetje raar voorbeeld
Example: echo "<td width=\"5%\">";
Example: echo "<td width='5%'>";
verder leuke tutorials
Flamer - 2008-11-19
Silentkill moet er ook weer mee bemoeien -.-...zucht.
Anyways, tut klopt helemaal!
ik heb trouwens een php scriptje gemaakt wat ook handig is, waar kan ik die uplooijen ??
Anyways, tut klopt helemaal!
Remco - 2008-11-19
Flamer, what do you mean ?
What sort of PHP script ? lol i can't just allow people to upload entire PHP scripts due to security risks, but you can always ask me to use scripts in my tutorials
Send me a mail about it please lol
What sort of PHP script ? lol i can't just allow people to upload entire PHP scripts due to security risks, but you can always ask me to use scripts in my tutorials
Send me a mail about it please lol
Sillentkil - 2008-11-19
kon het niet laten maar he je kent me
Maare volgens mij vertrouwd hij ons niet, ons n beetje niks laten plaatsen
ow mooie layout trouwens
Maare volgens mij vertrouwd hij ons niet, ons n beetje niks laten plaatsen
ow mooie layout trouwens
Remco - 2008-11-19
lol
ik vertrouw niemand, moet je maar is opzoeken wat mensen kunnen doen al laat je ze toe om scripts te uploaden lol
.. dan kan je alle rechten wijzigen e.d. spullen verwijderen blabla.. niet echt handig he
Flamer - 2008-11-19
ill send you a pb bout it.
You have to be logged in to write a comment.



