Web Hosting Talk







View Full Version : second attempt: convert website from html to php


kermalou
11-25-2003, 08:56 PM
i am looking to convert my website:

www.lavicpa.com

to something easier to use and so forth.

what do you guys rec., i tried this a while ago and didn't succeed.

Dan L
11-25-2003, 10:30 PM
Using basic PHP is very easy!

Anchor link: '?p=pagename'
Code for body:

<?php
$p = isset($p) ? $p.'.txt' : 'default.txt';
if(file_exists($p))
{
include $p;
}
else
{
echo 'Error!';
}
?>

Now, in the anchor link, you only put the page name, not the .txt extension. The .txt files should all have just the text you need in them, though HTML formatting is fine. As for your changing navigation bar at the top.. there are ways to do this, but for now the easiest method is to just keep it static.

Also, for clarification, the PHP goes where the content would go and the anchor tag is the <a> links.

Give it a try and tell me how it goes!

Rich2k
11-26-2003, 06:21 AM
$_GET['p'] not $p

$p won't work on default installations of PHP greater than 4.2.0

www.php.net is a great start for learning.

Remember PHP is a server side language not a client side language so your HTML will still be outputted to the browser. The PHP just does the stuff before the HTML gets sent to the browser.

Dan L
11-26-2003, 04:50 PM
Rich: Ah, I use $_GET but forgot since I was just throwing this together as an example. :)

airnine
11-27-2003, 05:58 AM
it's a basic redesign, a week of work and you have a brand new php site

Reptilian Feline
11-27-2003, 07:27 AM
When you get stuck, post some code and we will help you.