HTML Tags

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Zeceer
Forum Contributor
Posts: 136
Joined: Fri Aug 02, 2002 5:10 am
Location: Norway

HTML Tags

Post by Zeceer »

I'm just wondering. Whats the point og writing

<html>
<head>
</head>
<body>
</body>
</html>

in a file? If you don't write it it works just as great. Thing is that since it still works great it may be some other reasons to use the tags. Anyone?
User avatar
enygma
Site Admin
Posts: 175
Joined: Fri Apr 19, 2002 8:29 am
Location: Dallas, Tx

Post by enygma »

it's more correct...and some of the browsers out there dont parse it right if those arent there. not all browsers are IE.
cctrax
Forum Commoner
Posts: 36
Joined: Thu Jul 11, 2002 9:05 pm
Location: United States
Contact:

Post by cctrax »

I remembered I liked to cheat when I first began to program, and found out when I went to school, and tried to view the sites...they never came out the way they did at home (lol). Damn Netscape!!!!
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post by lc »

Yup

A lot of the time it's ok when you're designing on IE but then you view it in Netscape and grrrr

Like I forgot a </td> in something I was working on recently and didn't notice at all cause IE assumes it's there if you start a new <td> in the same table... but then someone comes along with NN and doesn't start the new <td>

Also of course the <head> tags are nice since you can set a title in there and for instance... the title is what's used when bookmarking a page. That's also why I have the title generated dynamicly with php so that even if all content (different version stuff) is loaded in a single .php page the title still shows what people are looking at.

it's just neater, more stable, practical and not a great deal of work.
User avatar
Zeceer
Forum Contributor
Posts: 136
Joined: Fri Aug 02, 2002 5:10 am
Location: Norway

Post by Zeceer »

Ok :-). The basic rules is that when writing PHP codes containing HTML you must add HTML tags on top and on the end og the code? But when writing pure PHP you need HTML tags?
MattF
Forum Contributor
Posts: 225
Joined: Sun May 19, 2002 9:58 am
Location: Sussex, UK

Post by MattF »

If you are writing viable code that you intend to be outputed (?) to a browser then you should format it properly so that it can be viewed as you intended by anyone who wants to view, not just those with the same browser as you.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Zeceer wrote:But when writing pure PHP you need HTML tags?
If by pure PHP you mean a config file or function file then no. You should also only have one opening and one closing <html>, <head> and <body> tag per document. So if you have a templating system which includes a header, navigation bar, main content and footer, you shouldn't have these tags in each of those files. Instead you should work your template so that they all appear once in the correct place.

Mac
Post Reply