Converting html to php

welshman

Senior Member
Joined
May 9, 2009
Messages
1,103
Reaction score
540
I'm considering converting my website that I started about 8 years ago from html to php. The things is, because it is so old, it's been tacked on bits and pieces and is now currently 200 pages. I do not have the time or the desire to do everything manually. Did a search on google.

Found this solution:

Code:
http://www.visitor-stats.com/articles/convert-html-website-php.php

Could anyone tell me if this is possible? Would it work? Or anyone have a better solution?

Thanks.
 
I don't get it well you can integrate php to html or html to php so let's say that your website has tags like
HTML:
<option value="28" class="fjdpth1" ></option>


So in php it will become

PHP:
echo '<option value="28" class="fjdpth1" ></option> ';

So the main difference between php and html is that html is for the look of your website.
But with php you can create some great functionality for it.
You actually cant turn html to php you can only change the way how it will be outputted.
 
Ok. So if I wanted to add a script that was actually designed for a php file, do I have any chance?
 
If you wanted to add a PHP script into a HTML, you would just rename the .html to .php and paste the script in where you want it.

Edit: If you need a hand with anything, I can help. (For free)
 
Last edited:
why don't you use joomla as a cms to make things easy for you?
 
Ok. So if I wanted to add a script that was actually designed for a php file, do I have any chance?

Not problem at all just add the php part within PHP brackets like this lets take an piece of html code and add some php to it

HTML:
<html>
<head>
</head>
<body>

  <div id="content">  


<?php

$imcool = 'cool';

if($imcool == 'cool')
{
echo 'You man your really cool';
}

?>

    </div>

</body>
</html>
That' it save your file with extension .php and your done
 
Thanks for all the info everyone. Now I'm going to look at a way to include the same script to 221 pages. lol.
 
If you have Dreamweaver there is a feature called Find and Replace in files. You can parse for a similar part in all the 221 pages and replace it with the PHP.

eg:
Find: <title>
Replace with: <title><?php echo $title;?>
 
I hope you understand you cannot convert html to php. You can integrate php into your website, however. If you are not planning on changing the content at all with php, there is absolutely no point in using it. The point of it is to make dynamic webpages (not always the same content) by having the server decide what html to send to the user.
 
If it was me I would program a little php script to parse the old data and input that into a database, then write a simple php backend to retrieve and display the information. If your interested I will code it for you, for a price.
 
php is a server-side programming language, html is the presentation language for websites, you have to use html no matter what to present the page in the browser (usually with css, javascript, etc too)... its not possible to display php in a web browser in any meaningful way to an end user.. I guess you are trying to convert the structure of your site to php though but its probably best to get a php programmer at least to start with
 
Back
Top