Very new Newbie to PHP with a Question..

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

Post Reply
TheeDanimal
Forum Newbie
Posts: 2
Joined: Sun Sep 14, 2003 3:41 pm

Very new Newbie to PHP with a Question..

Post by TheeDanimal »

I'm trying to convert my html pages to php, is there a software I can use or a simple way to do it, I plan on learning more about php adn fixing things up so that changes can be made easier,

Is there a place someone can start me out with?
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

nothing i knwo of to do it automatically.


http://www.php.net


that should be your first stop whenyou have errors
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

There are no such things as html2php converter, as it so much different from each other.

The manual (as m3rajk mentioned) is a place where most people start at. Also PHPDN member sites (check that page at the lower left, LINKS) is more or less specialized on various areas.

Visit those places, try something out, and get back to us if you need more help. And good luck!
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Php manual on php.net - can download a version with user comments which I'd recommend.

Mysql manual from mysql.com.

Relational architecture & db normalisation article http://www.oreilly.de/catalog/javadtabp ... r/ch02.pdf
(looks tough but you need to know this stuff).

Install a local test server - see: http://www.hotscripts.com/PHP/Software_ ... tion_Kits/

Check links out from this site and php.net, zend.com for various articles.

Handy tool to try out regex expressions: http://www.weitz.de/regex-coach/#install
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

The easiest way to convert an HTML page to PHP is to change the extension of the page - instead of .htm/.html change it to .php. Then (if you've got PHP setup on your computer) you can start adding PHP code to the pages.

Note that PHP does not replace HTML, they are very, very different things.

Definitely use the links that you've had posted for you - lots of good resources.

Mac
TheeDanimal
Forum Newbie
Posts: 2
Joined: Sun Sep 14, 2003 3:41 pm

Post by TheeDanimal »

Thanks everyone Ill start with that
Bizwala
Forum Newbie
Posts: 12
Joined: Tue Sep 09, 2003 12:10 pm
Location: Las Vegas, Nevada

Post by Bizwala »

If you just want to change the file extension .html to .php you can write a mini script using opendir()

Code: Select all

<?php
$dir = "temp/";

if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if(ereg(".html",$file)) { //list all files with .html extension
                print nl2br("filename: $file" . "\n"); //verify they exist
                $phpfile=str_replace(".html",".php",$file);//create php file
                copy($file,$phpfile); //copy file
                unlink($file); //delete .html file
            }
        }
        closedir($dh);
    }
}
?>
This should work, but you should add some php chmod functions in there too.
User avatar
SantaGhost
Forum Commoner
Posts: 41
Joined: Mon Sep 15, 2003 11:54 am

Post by SantaGhost »

you should know what youre expecting from php to add to your website, you can just change all pages to .php and they will still work fine and you can add php code to them (<?php .. ?>)

the idea behind php is to make the content of websites dynamic, without having to make changes to a hundred html pages if you just want to change the logo....
AaronSmith
Forum Commoner
Posts: 32
Joined: Fri Mar 28, 2003 3:14 pm

Post by AaronSmith »

To be very specific... PHP is a programming language while HTML is (now) used for design. I suggest you also look into MYSQL, as your web page could most likely benifit from a database.
User avatar
SantaGhost
Forum Commoner
Posts: 41
Joined: Mon Sep 15, 2003 11:54 am

Post by SantaGhost »

AaronSmith wrote:To be very specific... PHP is a programming language while HTML is (now) used for design. I suggest you also look into MYSQL, as your web page could most likely benifit from a database.
yes, it would shure be worth it to take a look at CSS too, which will save you a lot of design and layout work, a good starting point is

http://www.w3schools.com/css/
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

AaronSmith wrote:To be very specific... PHP is a programming language while HTML is (now) used for design. I suggest you also look into MYSQL, as your web page could most likely benifit from a database.
no. do not call a scripting language a programming language.

i know programmer that get very upset.

scripting languages are very different from programming languages. there are some things you can't do with programming languages you can do with scripting languages. and something scripting langs are much better for.


php is a scripting language.

it was designed specifically to give state to a stateless protocil. keep that in mind when you write with it

you need xml or html or some other markup language to give formatting to output from scripts in php.
AaronSmith
Forum Commoner
Posts: 32
Joined: Fri Mar 28, 2003 3:14 pm

Post by AaronSmith »

Geesh... I was trying to make it easy!

Thanks for the ass kickin! :D
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

there's a big difference between scripting and programming languages. and an even bigger one between them and mark ups.

as i pointed out, it's a bad idea to think of programming and scripting languages as the same. their functinoality is different.

it could be detrimental down the line if he thinks of them as the same.
AaronSmith
Forum Commoner
Posts: 32
Joined: Fri Mar 28, 2003 3:14 pm

Post by AaronSmith »

Just curious... Why are those that script PHP called programmers?
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

same reason those that script in perl are.


genreally if you use scritping languages you're either a web designer that doesn't necessarily know programming languages or you know several of tose as well.
Post Reply