06-27-2008, 04:33 PM
OK, I have never really given much to this site, so I've decided now that I'm going to, in parts, teach you PHP code the way I learned it.
ALL CREDIT GOES TO homeandlearn.co.uk
ANATOMY OF A WEB PAGE
DOWNLOAD HTML EDITOR: http://www.homeandlearn.co.uk/WD/downloadEditor.html
What is a web page?
Files on your computer come with extensions. If you wrote a letter using Microsoft Word and saved it with the name "MyLetter", the software would add three letters to the file name. Because it was typed using Word, the three letters that get added to your filename are .doc. So your file name will be "MyLetter.doc" and not just "MyLetter". If you created a spreadsheet in Microsoft Excel and called it "Accounts" the Excel software will add its own three letter extension to your file name. It will add .xls. So the file name will be "Accounts.xls" and not just "Accounts". So you get a different three letter extension depending on the software you used.
These three letter extensions are very important to computers. They are used to identify the type of file it is. With a file extension, Word can recognise its own documents. It sees the letters doc and says "Ah yes, that's one of mine. I can open it." If it sees a different extension, xls for example, it says "What the heck is that?" You'll then get an error message telling you that the file type is not recognised.
Web pages have their own file extensions. Oddly there are two different extensions, a three letter file extension and four letter extension. Web pages come with the extension .htm or .html. A browser can recognise either extension. With our software, the four letter extension is used when web pages are saved. (The letters HTML, incidentally, stand for Hypertext Mark-up Language.)
When you Open up a web page with your browser, Internet Explorer for example, the browser software checks the file extension, the same check that Word and Excel makes. If it sees the .htm or .html extension it knows it's a web page and then tries to open it. (Modern browsers, though, can open up other types of files. Internet Explorer can open up your Word documents and PDF files.)
Behind the scenes, however, the thing that Internet Explorer is trying to open is really a text file that has had its extension changed from .txt to .htm. The text file though will have special symbols and words, called Tags. When the browser sees these Tags it goes to work, displaying whatever you typed and hiding the Tags from your viewers.
If all that seems a little confusing, don't worry. It will become clearer as you progress. For now, our goal is to design a first web page. So load up your web design software, and let's begin.
THE FIVE MINUTE WEBPAGE
Load up the HTML Editor you downloaded.
Click File from the menu bar
From the drop down menu, click New
When you click New, a dialogue box pops up asking you to choose your Background options.
The default is set to None. Click "Background Colour". The dialogue box changes to show you the background colour options.
Click the black down-pointing arrow just to the right of White to reveal a drop-down list of colours for your web page. Clicking the "More" button will reveal another dialogue box with a wider range of colours to choose from. For now, though, select one of the colours from the drop-down list.
Before clicking the OK button, notice that you can also set a Background Image for a web page, instead of using a coloured background. We'll explore this later.
When you have chosen your colour from the drop-down list, click the OK button. The dialogue box will close, and a rather daunting code will now be in your editor's window.
We'll explain what all that code means in a moment, but as we're designing a five minute web page, let's crack on.
The cursor will be flashing right at the top of your code. Move it down so that it's flashing on an empty line after
From the menu bar, click on Insert > Heading > H1
When you click H1 (the H stands for Heading) a pair of H1 tags will be inserted onto your page. We'll get on to what tags are soon, but for now just type something in between those pair of H1 tags:
Nearly there. Next, highlight that entire H1 line, like in the image below:
From the menu bar, click on Format > Centre. When you do, another pair of tags will be added to the start and end of those H1 tags. Your code will now look like this:
Notice the spelling of the centre tag, you Brits! It's CENTER. The American spelling "er" is used in HTML, rather than the English "re".
OK, we're done with our five minute web page. Time to see what it looks like.
Click File > Save As and save your work
Then click View > View Web Page (or click the pair of glasses on the toolbar).
Your web page should launch in your browser
Congratulations! You have designed a web page. Easy, wasn't it? Now for the slightly more difficult part of understanding what it was you actually did.
ALL CREDIT GOES TO homeandlearn.co.uk
ANATOMY OF A WEB PAGE
DOWNLOAD HTML EDITOR: http://www.homeandlearn.co.uk/WD/downloadEditor.html
What is a web page?
Files on your computer come with extensions. If you wrote a letter using Microsoft Word and saved it with the name "MyLetter", the software would add three letters to the file name. Because it was typed using Word, the three letters that get added to your filename are .doc. So your file name will be "MyLetter.doc" and not just "MyLetter". If you created a spreadsheet in Microsoft Excel and called it "Accounts" the Excel software will add its own three letter extension to your file name. It will add .xls. So the file name will be "Accounts.xls" and not just "Accounts". So you get a different three letter extension depending on the software you used.
These three letter extensions are very important to computers. They are used to identify the type of file it is. With a file extension, Word can recognise its own documents. It sees the letters doc and says "Ah yes, that's one of mine. I can open it." If it sees a different extension, xls for example, it says "What the heck is that?" You'll then get an error message telling you that the file type is not recognised.
Web pages have their own file extensions. Oddly there are two different extensions, a three letter file extension and four letter extension. Web pages come with the extension .htm or .html. A browser can recognise either extension. With our software, the four letter extension is used when web pages are saved. (The letters HTML, incidentally, stand for Hypertext Mark-up Language.)
When you Open up a web page with your browser, Internet Explorer for example, the browser software checks the file extension, the same check that Word and Excel makes. If it sees the .htm or .html extension it knows it's a web page and then tries to open it. (Modern browsers, though, can open up other types of files. Internet Explorer can open up your Word documents and PDF files.)
Behind the scenes, however, the thing that Internet Explorer is trying to open is really a text file that has had its extension changed from .txt to .htm. The text file though will have special symbols and words, called Tags. When the browser sees these Tags it goes to work, displaying whatever you typed and hiding the Tags from your viewers.
If all that seems a little confusing, don't worry. It will become clearer as you progress. For now, our goal is to design a first web page. So load up your web design software, and let's begin.
THE FIVE MINUTE WEBPAGE
Load up the HTML Editor you downloaded.
Click File from the menu bar
From the drop down menu, click New
When you click New, a dialogue box pops up asking you to choose your Background options.
The default is set to None. Click "Background Colour". The dialogue box changes to show you the background colour options.
Click the black down-pointing arrow just to the right of White to reveal a drop-down list of colours for your web page. Clicking the "More" button will reveal another dialogue box with a wider range of colours to choose from. For now, though, select one of the colours from the drop-down list.
Before clicking the OK button, notice that you can also set a Background Image for a web page, instead of using a coloured background. We'll explore this later.
When you have chosen your colour from the drop-down list, click the OK button. The dialogue box will close, and a rather daunting code will now be in your editor's window.
We'll explain what all that code means in a moment, but as we're designing a five minute web page, let's crack on.
The cursor will be flashing right at the top of your code. Move it down so that it's flashing on an empty line after
Code:
"<BODY BGCOLOR = Magenta>" but before </BODY>.From the menu bar, click on Insert > Heading > H1
When you click H1 (the H stands for Heading) a pair of H1 tags will be inserted onto your page. We'll get on to what tags are soon, but for now just type something in between those pair of H1 tags:
Code:
<H1>My First Web Page</H1>Nearly there. Next, highlight that entire H1 line, like in the image below:
From the menu bar, click on Format > Centre. When you do, another pair of tags will be added to the start and end of those H1 tags. Your code will now look like this:
Code:
<CENTER><H1>My First Web Page</H1></CENTER>Notice the spelling of the centre tag, you Brits! It's CENTER. The American spelling "er" is used in HTML, rather than the English "re".
OK, we're done with our five minute web page. Time to see what it looks like.
Click File > Save As and save your work
Then click View > View Web Page (or click the pair of glasses on the toolbar).
Your web page should launch in your browser
Congratulations! You have designed a web page. Easy, wasn't it? Now for the slightly more difficult part of understanding what it was you actually did.