HTML to PHP

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

User avatar
Assured99
Forum Commoner
Posts: 81
Joined: Wed Jul 12, 2006 11:48 am
Location: California

HTML to PHP

Post by Assured99 »

Is there any effective method or program to covert all your HTML pages to PHP, of should you only use php on the pages that require it ??

Im interested in transfering my site which is http://www.assuredmedical.com to PHP but im not sure it is the best decision. Any pro's and con's would be greatly appreciated.

Thanks

~Snapple
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

As long as you have PHP on your server, all you need to do is rename the file extension for all of your files to .php from .html and then make sure all of the links are updated to have .php instead of .html.

Yes you can use PHP for just HTML files.

Pro's
More dynamic content (you can do more stuff with PHP and if you have users login then there is a lot more you can do)

Con's
To much codes (PHP ONLY) slow the page down.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Also for the page: http://www.assuredmedical.com/referral/welcome.html

you could have the users login on a regular page and then only display the content if the session variable login is present or something like that. If you need help feel free to AIM me.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

The only reason to switch it to php would be if you want to add some sort of dynamic content. Don't switch to php just to have it switched to php... it's not even worth the time. The pro of doing so would be if you wanted to dynamically call the header/menu/footer of your page so that there would be a central place to edit this portions. Just changing your extension to php is pointless.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

The Ninja Space Goat wrote:Just changing your extension to php is pointless.
I agree, was talking about to convert to PHP and acutally put PHP on the pages.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I'm with Ninja. If you are actually going to use a decent amount of PHP functionality in your site, switch it. But for the sake of serving up pages, leave them static if you do not have a need for dynamic pages.

For me, I did do this with all of my sites. But for me, it was because I moved all my sites to some form of CMS so that I could manage content online rather than having to FTP pages to the server everytime there was a change.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I did also, but it was only because I wasn't yet using Dreamweaver to manage all of the content. Now I just use Templates and Library files (before I used php includes for menus, headers and footers)
User avatar
Assured99
Forum Commoner
Posts: 81
Joined: Wed Jul 12, 2006 11:48 am
Location: California

Post by Assured99 »

you could have the users login on a regular page and then only display the content if the session variable login is present or something like that. If you need help feel free to AIM me.
That is my main purpose for switching to PHP, im swift in html but a newbie to php and i dont want to get in over my head. but that is what the goal is. any help would be greatly appreciated. I dont use AIM at work but i do have MSN Owen___D@hotmail.com
The only reason to switch it to php would be if you want to add some sort of dynamic content. Don't switch to php just to have it switched to php... it's not even worth the time. The pro of doing so would be if you wanted to dynamically call the header/menu/footer of your page so that there would be a central place to edit this portions. Just changing your extension to php is pointless.
This is also something i was interested in but im unsure of how to make it happen.

I assume that i would create a PHP script that would have the footer, then call it on to my pages.

Am i in the right ball park here ???
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Yes... so it would look something like:

header.inc.php

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Your page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
footer.inc.php

Code: Select all

</body>
</html>
index.php

Code: Select all

<?php
include("header.inc.php");
?>
<!-- Content would go here /-->
<?php
include("footer.inc.php");
?>
User avatar
Assured99
Forum Commoner
Posts: 81
Joined: Wed Jul 12, 2006 11:48 am
Location: California

Post by Assured99 »

For me, I did do this with all of my sites. But for me, it was because I moved all my sites to some form of CMS so that I could manage content online rather than having to FTP pages to the server everytime there was a change.
Moved your sites to some form of CMS??? what is CMS for me that is Center for Medicare Services LOL
User avatar
Assured99
Forum Commoner
Posts: 81
Joined: Wed Jul 12, 2006 11:48 am
Location: California

Post by Assured99 »

Yes... so it would look something like:

header.inc.php
php:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Your page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>



footer.inc.php
php:

</body>
</html>



index.php
php:

<?php
include("header.inc.php");
?>
<!-- Content would go here /-->
<?php
include("footer.inc.php");
?>

So could i use this to call my navagation for my pages? Ie. the links on the bottom of my page or the side???

Also could i make the header.inc.php stright html that will be placed??? or does the header.inc.php have to be coded in php?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You are in the parking lot of the ballpark :wink: .

You are going to want to probably (depending on your setup) create a header and footer section. Use them as includes from within the calling PHP page. As a newbie, I would tend to start off with a page, say index.php, that hits the database, grabs some page content or some links or something, then echos them to the screen. Before the echo, include header.php. After the echo, include footer.php.

Header and Footer pages are those parts that are above and below your general page content. These can be static HTML pages or PHP pages, whichever you fancy.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

CMS = Content Management System (in Geek).

PS My last post was posted way later in the thread than I thought it would be. :x
User avatar
Assured99
Forum Commoner
Posts: 81
Joined: Wed Jul 12, 2006 11:48 am
Location: California

Post by Assured99 »

As a newbie, I would tend to start off with a page, say index.php, that hits the database, grabs some page content or some links or something, then echos them to the screen. Before the echo, include header.php. After the echo, include footer.php.


Thanks so much, its all starting to make sence sorta!

Ive been reading my behind off and i cant seem to find something that makes sense about scripts that query a database. and for that matter what type of database i can use, can i use MS Access??? i understand that you would have to call the field names ie fname or lname email etc... but how to validate them and how to code the php to do these things.
User avatar
Assured99
Forum Commoner
Posts: 81
Joined: Wed Jul 12, 2006 11:48 am
Location: California

Post by Assured99 »

I was just getting into it and everyone disapears

LOL :roll:
Post Reply