How difficult is it to turn a HTML page into a PHP page? What advantages, if any, does a PHP page hold that a HTML or XHTML page doesn't? What are the disadvantages, if any? I am building my own, personal website and I am just wondering about these things.
It all depends on what kind of dynamic content do you need. HTML code works just fine in PHP. In fact, it's just like HTML except the embedded PHP code needs to be surrounded by <? and ?> tags.
php is only good if you want to have dynamic content created on the server side. If you don't, then don't even bother.
Do you understand that, unlike HTML, PHP requires a parser on the web server to interpret functions that HTML does not have? It's not just an extension or a name of the file. PHP is on your web server installation and will only parse tags in the PHP format, which looks like: < ?php > (no spaces). PHP is like ASP and Perl, they write HTML based on functions on the server's software. HTML is not a programming language, but PHP is. What or how were you persuaded or became curious about PHP?
I eventually want dynamic content after I learn my XHTM and PHP some more. So if I understand you guys correctly to turn my page into a PHP one I would just adde <php?> and <?> around my html code? The I would rename it right for example from php.html to php.php?
Well I am taking a XHTML class and we were briefly introduced to it in the last chapter but I would like to learn more. I went and bought another book to help me learn that as well.
Go to www.php.net . The introduction pages, like the "hello world" and the explanations, are great ways to learn. (Chapter 10) If you can get your hands on the demo for DreamWeaver, they have database-driven tutorials for PHP that can be easily deciphered once you know what code is written. My only advice to learn "MORE" is to learn ALL the HTML you can before you can go on to PHP. Try the "Beginner's Guide to HTML" (google it). It's cool you want to take the next step, man. CRAWL, then WALK, then RUN.
That's correct, but be sure you are on a webhost with PHP support. In a nutshell, it is almost like HTML except the PHP code determines what displays as HTML within the PHP block. I hope that makes sense to you.
this page is perfect timing... my buddy and i are workin on changin our site from HTML to PHP... obviously all the links have to be redirected from index.html to main.php any suggestions to make this easier, rather than the tedious process of changing each page?
yup... when designing a page, I'd start with the html to develop the look and feel of the page. After that is complete, then I'd work with the dynamic content with PHP.
One thing I don't get, why do you have to rename the file .php? Will the php code not get recognized otherwise on the server side if it is still .html?
The server looks at the extension to determine if it needs to be processed, so no, the PHP code wouldn't be parsed if you leave the extension as html.
It's really a question about server-based vs client-based. Although web browsers only see a final HTML page on the end, PHP file is fed by server with all kinds of dynamic content. It could be a little tedious to transform from pure HTML pages to PHP, or ASP, or JSP, but it's a whole lot more easier to maintain and upgrade. If one only looks for updating content from time to time, without touching the whole structure, layout, or business logic. It could be a simple once for all task. From that point on, you can use your new admin GUI to do the update, just like this very message board. It's definitely worth the time and effort.
And just WHY are you linking to "index.html"? Learn your lesson: next time, just link to "/" and it will go to the top level page, whether index.html, index.php, or anything your server decides is the top level page. Please, don't ask me WHY. You should know why. If your links go href="/index.html" or href="index.html", you're a web-design newb. Back on topic, Lil Pun, follow one of my Web Design credos: Just because YOU CAN, doesn't mean YOU SHOULD. In fact, if you just "rename" all the files to .php, the server will think the files will have to be parsed through the PHP interpreter, and it will delay the response to the browser. Something to think about.
Anybody mind helping with this problem? Here is my code: When I visit my webpage I get this message: Parse error: syntax error, unexpected '<' in /home/dotson-j/public_html/index.php on line 3
Sorry about that, the code was posted but the site interpretted and put it out. Here it is with spaces so the code is shown:
Just finished switching back from php to html. A complete disaster with our organic search results. We were trying to consolidate the stand alone shopping carts of a network of niche ecom sites - I let the tech guys talk me into this "wonderful" system. Net result - over 1m in sales drop over the network during the time it took to put everything back the way it was and regain the serps.