PHP... HTML... does it really matter?
Posted: Thu, 2008-06-12 22:25
I tried to look around the forum to find my answer but I don't know where to begin or even what it's called.
I have to save all my file in .php because if I save them in .html they don't work once I load them to my server.
In php everything works great, the only thing is I have to use .php in the address bar at the end instead of .html.
example: www.mydomain.com/page2.php instead of .html
(for future reference, how do you stop the BBcode so that a link is not clickable, like the one above?)
I know that most people are used to write .html... but does it really matter?
Thanks for your time,
Louis
PS: I'm using a couple of external files for my navigation menu and my footer... In case it matters too. 


Moderator
Posts: 6662
Joined: 2004-05-01
Location: Brisbane
If you do
Posted: Thu, 2008-06-12 22:33
If you do www.mysite.com/folder/ it doesn't matter what the file extension is - just create a file called index.??? and place it in that folder.
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
newbie
Posts: 7
Joined: 2008-06-12
Location: south Florida
do you know why I can't use
Posted: Thu, 2008-06-12 23:56
do you know why I can't use the .html extension... what am I doing wrong?
Thanks
Moderator
Posts: 12308
Joined: 2004-06-06
Location: London
Explain what's in these
Posted: Fri, 2008-06-13 00:17
Explain what's in these files?
From your initial post your last paragraph suggests the answer which is that you are including other files into this particular one and the method being used to perform this is the PHP server side scripting language; this requires that the file is sent by the server to the PHP parser to be read and actioned, the server knows to do this because it checks the file to see which have a extension .ph.
These files can, however, contain html code as well as php script also the server can be told to send .html extensions to the parser as well; the extension is in reality not that important and is only intended as a indicator of file contents.
Do have to point out that this post has no relation to the forums focus of CSS so moving to 'Off Topic'
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me
newbie
Posts: 7
Joined: 2008-06-12
Location: south Florida
Sorry Hugo, I was so focus
Posted: Fri, 2008-06-13 01:37
Sorry Hugo, I was so focus on putting my website online that I didn't even think about it... but you're right it's not css.
Ok, I do have all the parts (menu, footer, etc.) in php but If I put my index and other pages with the php extension the site crash. all I have left is the text with no style whatsoever... (I guess it's a little about css)
what's in my files:
in my index.php file
<html>
<body>
<div id="navbar">
<?php include("navbar.php"); > "I took out one (?) for the BBcode."
</div>
</body>
</html>
In my navbar.php file
<h2>MENU</h2>
<ul>
<li><a href>HOME</a></li>
<li><a href>Contact Us</a></li>
</ul>
also here's my DOCTYPE and <head> in my index file just in case.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/xml; charset=utf-8" />
<title>Untitled document</title>
<link rel = "stylesheet"
type = "text/css"
href = "stylesheet.css" />
</head>
I know when I'm surfing the net, I'm always putting .html at the end of the address but rarely .php, does it make a big difference?
Moderator
Posts: 6662
Joined: 2004-05-01
Location: Brisbane
If your page is made up of
Posted: Fri, 2008-06-13 02:20
If your page is made up of PHP includes, it has to be saved as a .php file. You can't have PHP includes in .htm or .html files.
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
newbie
Posts: 7
Joined: 2008-06-12
Location: south Florida
Well I whent all over the
Posted: Fri, 2008-06-13 03:59
Well I whent all over the internet looking at big websites and I couldn't find any html pages with php command in them.
I guess the bottom line is, it doesn't matter... right.
My whole website is going to be in php files, so what!
Moderator
Posts: 5110
Joined: 2005-02-03
Location: Pennsyltucky, USA
louisgeorges wrote:Well I
Posted: Fri, 2008-06-13 04:28
Here: http://php.net
php is parsed into html you can't see the underlying code. That's part of it's charm.
FREE CHEESE!!! NIEKIE SHOES FOR SAIL. CHEAP JUNKY COMPUTERS!!!!one! ELEPHANTITIS CUREZ~ AN EAGLE FOR SALE!!! APES and LARVAE! MAKESHIFT PIANO SCORE!!! KNICKERS AND HATRED!!! ALL FOR SAL ONE CHEAP PRICES!! ORDER NOW. NEARLY AMERICAN MADE.
newbie
Posts: 7
Joined: 2008-06-12
Location: south Florida
Yeah I forgot once you
Posted: Fri, 2008-06-13 04:48
Yeah I forgot once you implement the php command it disappears. Damn it Triumph now I'm back to square one!!!
Then how the hell does anyone use .html extension?
Moderator
Posts: 5110
Joined: 2005-02-03
Location: Pennsyltucky, USA
.html is just for static
Posted: Fri, 2008-06-13 04:52
.html is just for static HTML. No parsing, no dynamic bits.
the .php extension tells the server to parse your page through the php parser and serve up the ending HTML
.asp and .aspx works the same way as .php but only on a windows server.
You can also force your server to parse .html through the php parser but there's no shame in using .php. What's the aversion to just using the correct file extension?
FREE CHEESE!!! NIEKIE SHOES FOR SAIL. CHEAP JUNKY COMPUTERS!!!!one! ELEPHANTITIS CUREZ~ AN EAGLE FOR SALE!!! APES and LARVAE! MAKESHIFT PIANO SCORE!!! KNICKERS AND HATRED!!! ALL FOR SAL ONE CHEAP PRICES!! ORDER NOW. NEARLY AMERICAN MADE.
Moderator
Posts: 6662
Joined: 2004-05-01
Location: Brisbane
louisgeorges wrote:Then how
Posted: Fri, 2008-06-13 04:53
Why do you want to? Just use .php!
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
Moderator
Posts: 5110
Joined: 2005-02-03
Location: Pennsyltucky, USA
louisgeorges wrote:... I
Posted: Fri, 2008-06-13 04:58
You think that people will type http://www.blahblah.com/cheeze.html when it should be http://www.blahblah.com/cheeze.php
No. if people have to do more than type blahblah.com *enter* and then click from there then you're too complicated for them to stick around.
If you're still concerned take Tyssen's advice above and make a directory and drop an index.php file in there (or whatever your server's default document is set to). blahblah.com/cheeze will go to http://www.blahblah.com/cheeze/index.php
FREE CHEESE!!! NIEKIE SHOES FOR SAIL. CHEAP JUNKY COMPUTERS!!!!one! ELEPHANTITIS CUREZ~ AN EAGLE FOR SALE!!! APES and LARVAE! MAKESHIFT PIANO SCORE!!! KNICKERS AND HATRED!!! ALL FOR SAL ONE CHEAP PRICES!! ORDER NOW. NEARLY AMERICAN MADE.
newbie
Posts: 7
Joined: 2008-06-12
Location: south Florida
Triumph wrote:You think that
Posted: Fri, 2008-06-13 05:31
Exactly! Also I'm worried that after all that work I'm going to discover a bug or something and have to redo all the work in "html correct" file.
But if you guys say that either one is fine and, like you said Triumph, link everything right so that nobody has to type anything, then there shouldn't be any problems.
Thanks a million guys!!!
Moderator
Posts: 12308
Joined: 2004-06-06
Location: London
If you find a bug, fix it!
Posted: Fri, 2008-06-13 05:55
If you find a bug, fix it!
You won't find a bug that causes you to have recode a page dropping the php from it.
users don't type url they click on google links or at most they type the name into the address bar and hope it resolves.
Structure your site with thought as to it's directory structure then as has been suggested you work with index. files in each one this goes some way to creating nice clean url structures if your site is more dynamic than that and templated then you might have to use re-writing to get clean urls.
Overall you are worrying unnecessarily, I do all my private work exclusively using php it's simply a matter of course and at work we use coldfusion, I haven't used the html extension in a long while.
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me
Leader
Posts: 622
Joined: 2007-05-31
Location: Bournemouth
Hmmmm... Let me know if
Posted: Fri, 2008-06-13 08:14
Hmmmm... Let me know if this helps.
Imagine you have two people. Harry The Man (HTM) and Paul tHe Person (PHP).
They're both Men. They both look the same, and act similarly and when talking to them they speak in the same language because that's the language you (Mr. Browser) talk.
However, Paul tHe Person is bilingual and slightly more intelligent. If they were both asked to present to you a document they'd been given but it had a little French in it and perhaps a calculation, then Harry would casually breeze over these bits not quite understanding what's going on. Paul on the other hand would translate the French back, do the sums, and provide you with the whole picture.
It still sounds the same from both to you, Mr. Browser (it's still HTM), it's just that Pauls equivalent contains more because he understands more. As Hugo says, it sounds like you might have a line of code in there like include("menu.php"); (inside php tags) which is french to old Harry so will be ignored, but Paul will translate it in to HTM for you.
The extension, simply tells you whom to send the document too. If you send a document with no PHP in to Paul, it will look just the same as if you had sent it to Harry. However, send a document WITH php in to Harry and it will have bits missing.
Does that help to clarify a little?
Sorry if I've completely misunderstood your confusion...
J
Have YOU said Hello yet?
The CSSCreator Hello Thread
Moderator
Posts: 6662
Joined: 2004-05-01
Location: Brisbane
I don't know about anyone
Posted: Fri, 2008-06-13 08:28
I don't know about anyone else, but I find the analogies (this and the one about doctypes) completely confusing and I already know about the subject matter that they're supposed to pertain to.
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
Leader
Posts: 622
Joined: 2007-05-31
Location: Bournemouth
Fair enough
Posted: Fri, 2008-06-13 08:59
Fair enough Tyssen, I respect that. Is it the analogies themselves, my way of relating them (i.e. switching from real life to analogy and back to often), or just the concepts of analogies generally you have difficulty with?
Personally I have found people, particularly those struggling with technical concepts, really appreciate them. If anyone has any opinions on the matter, I would be glad to hear them.
In the mean time, I was only trying to help and if anyone does find them confusing, I suggest what I would have thought to have been the obvious solution of simply ignoring them.
Cheers,
Johnny B
Have YOU said Hello yet?
The CSSCreator Hello Thread
Moderator
Posts: 5678
Joined: 2005-02-22
Fwiw, its possible to tell
Posted: Fri, 2008-06-13 09:48
Fwiw, its possible to tell most webservers to process ".html" files as php.
e.g. Apache, in one of its cascade of configuration files including .htaccess.
Also in apache its possible to use mod_rewrite to transparently convert a missing "somefile.html" request into a "somefile.php" request.
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*)\.html$ $1.php [L]On Having Layout | The One True Layout | menus by listamatic
Guru
Posts: 2519
Joined: 2005-12-14
Location: Victoria British Columbia
Tyssen wrote:If your page is
Posted: Fri, 2008-06-13 12:54
Yes you can if you configure your server to do so. Most ISP's that provide php also honor htaccess files.
I could change my plea to guilty,
but I don't think it would stick.
Ed Seedhouse
Moderator
Posts: 6662
Joined: 2004-05-01
Location: Brisbane
Ed Seedhouse wrote:Tyssen
Posted: Fri, 2008-06-13 22:13
Yes you can if you configure your server to do so. Most ISP's that provide php also honor htaccess files.
If you read what Chris wrote directly above you, you still have to save the files as PHP; changing them to .html gets done on the server by .htaccess. I didn't suggest that earlier cos I got the feeling the concept would be a bit beyond the OP at this time.
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
Guru
Posts: 2519
Joined: 2005-12-14
Location: Victoria British Columbia
Well I just spent about half
Posted: Sat, 2008-06-14 00:22
Well I just spent about half a year working on a site (now out of date) that does just what you say I couldn't do. The files on the server all have .html extensions and included php code. I've since replaced it with a wordpress blog but I just rechecked the server and the file extensions on disk for the old site were mainly .html.
I could change my plea to guilty,
but I don't think it would stick.
Ed Seedhouse
Moderator
Posts: 5678
Joined: 2005-02-22
Tyssen wrote:If you read
Posted: Sat, 2008-06-14 01:40
You can do it both ways, have the server handle .html files as php (my first example .htaccess code) or have the server rewrite the page request using a different file extensions (my second example .htaccess code).
My personal favourite, is what you mentioned first up. Make each page the index file in a directory. Then you can use index.php, index.html or whatever else you have set your DirectoryIndex (Apache term, other webservers may differ) to.
On Having Layout | The One True Layout | menus by listamatic
newbie
Posts: 7
Joined: 2008-06-12
Location: south Florida
I love this forum, you guys
Posted: Sat, 2008-06-14 02:18
I love this forum, you guys rock! I never had my questions handled so fast, it's great!
Burlster,
I like your analogie. Since php is a better program, do you think that we're going to see more and more php files and less html?
Chris..S and Ed Seedhouse,
Well if it's just a matter of esthetic then I'm not going to worry about it anymore.
On a personal note,
just a few days ago I finished the layout for my very first website made from scratch. Sure the codes are not all perfect and I can't get everything exactly the way I want it but it's my website and I think I'm hooked!!!
I'm afraid you guys are going to get more stupid questions from me soon!
Thanks a lot guys, I'll talk to you with the next problem.
Moderator
Posts: 5110
Joined: 2005-02-03
Location: Pennsyltucky, USA
louisgeorges wrote:... Since
Posted: Sat, 2008-06-14 02:27
This forum (drupal) is php.
phpBB forums are php.
wordpress is php.
joomla is php.
SMF is php.
cube cart is php.
os Commerce is php.
Zen cart is php.
MediaWiki (wikipedia) is php.
I can probably list 1000 more.
PHP is not Martian technology.
FREE CHEESE!!! NIEKIE SHOES FOR SAIL. CHEAP JUNKY COMPUTERS!!!!one! ELEPHANTITIS CUREZ~ AN EAGLE FOR SALE!!! APES and LARVAE! MAKESHIFT PIANO SCORE!!! KNICKERS AND HATRED!!! ALL FOR SAL ONE CHEAP PRICES!! ORDER NOW. NEARLY AMERICAN MADE.
Enthusiast
Posts: 121
Joined: 2005-03-17
Guess I better get learning
Posted: Fri, 2008-06-20 16:35
Guess I better get learning some Harry and Paul.... do you think they sound gay? I bet they are you know. lol Sorry for the frivolity... just couldn't resist it.
Andy
Moderator
Posts: 5110
Joined: 2005-02-03
Location: Pennsyltucky, USA
AndyD wrote:Guess I better
Posted: Fri, 2008-06-20 19:11
Andy
Ummm. What?
FREE CHEESE!!! NIEKIE SHOES FOR SAIL. CHEAP JUNKY COMPUTERS!!!!one! ELEPHANTITIS CUREZ~ AN EAGLE FOR SALE!!! APES and LARVAE! MAKESHIFT PIANO SCORE!!! KNICKERS AND HATRED!!! ALL FOR SAL ONE CHEAP PRICES!! ORDER NOW. NEARLY AMERICAN MADE.
Enthusiast
Posts: 121
Joined: 2005-03-17
It was an attempt at
Posted: Fri, 2008-06-20 20:45
It was an attempt at humour.... a bit dry, and in vain.
Andy
Moderator
Posts: 5110
Joined: 2005-02-03
Location: Pennsyltucky, USA
AndyD wrote:It was an
Posted: Fri, 2008-06-20 21:07
FREE CHEESE!!! NIEKIE SHOES FOR SAIL. CHEAP JUNKY COMPUTERS!!!!one! ELEPHANTITIS CUREZ~ AN EAGLE FOR SALE!!! APES and LARVAE! MAKESHIFT PIANO SCORE!!! KNICKERS AND HATRED!!! ALL FOR SAL ONE CHEAP PRICES!! ORDER NOW. NEARLY AMERICAN MADE.
Leader
Posts: 622
Joined: 2007-05-31
Location: Bournemouth
Interesting...
Posted: Mon, 2008-06-23 07:33
For British Humour: Yeah, haha. I guess Paul is slumming it with his slightly less intelligent other half, but how could he resist someone whose name ends with 'The Man'? Now there's an extension he can enjoy
For American Humour: Harry and Paul are not in a relationship. They are simply two people whom I invented as part of an analogy to help describe the relationship between PhP and HTML.
Haha, just joking of course Triumph
Have YOU said Hello yet?
The CSSCreator Hello Thread
Enthusiast
Posts: 121
Joined: 2005-03-17
Scottish actually...
Posted: Mon, 2008-06-23 09:11
Scottish actually...
Leader
Posts: 622
Joined: 2007-05-31
Location: Bournemouth
Fair enough...
Posted: Mon, 2008-06-23 09:46
"The British people are today regarded by some as a single nation, and by others as a collection of separate nations - English, Scots, Welsh, - who share the island of Great Britain." - Wikipedia
Some interesting Wikipedia articles about the various forms of nationalities! I love that site
Have YOU said Hello yet?
The CSSCreator Hello Thread
Enthusiast
Posts: 121
Joined: 2005-03-17
We have differnet origins in
Posted: Thu, 2008-07-10 10:51
We have different origins in terms of language, race, different legal systems, financial systems (God only knows how many times my Scottish Cash has been refused in England, but there never seems to be the same problem with English notes in Scotland), and now a limited powers parliament. I think very view regard the different nations of the Great British nation as one nation... just ask any Scotsman, Welshman or Irishman. I am sure you will not be surprised by the answer you receive if you ask them where they come from or which nationality they are.... oops slipped off my soapbox... lol
Moderator
Posts: 12308
Joined: 2004-06-06
Location: London
Limited powers? Yes to an
Posted: Sun, 2008-07-13 07:04
Limited powers? Yes to an extent but think on the fact that you lot still get to be elected to a national parliament where you get a vote on purely English matters, there is a very disagreeable imbalance at work here; oh and lets not forget the huge amount per capita that gets allocated to Scotland, and which is far more than down south.
Full devolution equals an end of the Union, do we really understand what that means, will any of the nations survive?
Now we ought to move on to the religious aspect as this is what is really at the heart of this vexed issue, centuries old bitterness
Ooops soapbox. political ramblings on a technical forum, v.naughty
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me
Moderator
Posts: 5678
Joined: 2005-02-22
Hugo wrote:Limited powers?
Posted: Mon, 2008-07-14 00:08
Yes, its stupid that purely domestic english issues are debated in our national parliament. But it seems the english can't be bothered to come up with a system to separate them. I don't think there is any doubt that the Scots (and Welsh) MPs would support any sensible solution you could come up with.
Jaundiced, london media propaganda. murdoch press is particlarly big on this one. "The Herald" does this calculation regularly, they get some academic to do it who spends some serious time trying to break out Scottish spending and Scottish income from sources where it isn't so clearly labelled. While Scotland does still receive more per capita than england as a whole, it receives less than most of the regions of england, including london. Its the south-east and east anglia which bring the english average down below scotland. And that's before we even start talking about the oil revenue, of which, under normal international divisions, about 90% would go to Scotland.
The oil might be running out, but the new higher price results in a £6,000,000,000 bonanza for the treasury over a full year - none of which comes to Scotland.
Now we ought to move on to the religious aspect as this is what is really at the heart of this vexed issue, centuries old bitterness
Nothing to do with religion. Mostly to do with a healthy dislike for centralist london policies. If Maggie hadn't decided to trial the poll-tax on the Scots would there have been even the limited devolution we currently have?
Yes!
On Having Layout | The One True Layout | menus by listamatic
Moderator
Posts: 12308
Joined: 2004-06-06
Location: London
huh all the contra arguments
Posted: Mon, 2008-07-14 06:00
huh all the contra arguments I was expecting and ready for. The fact that[edit: following text removed as inappropriate to a technical forum, political and religious discussions are forbidden - auto bot mod]
Yeah but it is centuries old enmity at the heart of it all, whe..[edit: warning inflammatory remarks removed]
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me
Enthusiast
Posts: 121
Joined: 2005-03-17
I think we best leave this
Posted: Mon, 2008-07-14 09:00
I think we best leave this discussions... seems the Mods are out to get us (I'm an old Heavy Rocker, lol). But Chris is right..... and why couldn't the Poll tax be trialed in London all those years ago, when I was a student, of fond memories.... lol ? We had lots of protests and the like, and not much of it covered in the "national" press or media either... or was I just too studenty to watch the news on telly? lol.