/    Sign up×
Community /Pin to ProfileBookmark

Hi,

I currently run a site that is purely made of HTML!

Well recently me and my collegues on the site have decided its about time we moved on and have decided that we wish to convert the site we have now to a php site so that we can use php features throughout it and link it with our phpbb forum and php galleries!

what we want to know is how do you change the site into php from html properly? i know that you can change the .html to .php but its gotta be more complex than that!?

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@zprogMay 09.2004 — Well, if you just want to convert a normal HTML page to a PHP page, all you need to do is change the file extension, but that would just be a waste of PHP. I suggest you read through the PHP manuals at http://www.php.net and learn how to script with PHP so that you are not just displaying an HTML page with PHP, which is an absolute waste, unless you wish to include blocks of frequently used code.

One way to display an html page is this way, however, but you don't have to do that:
[code=php]
<?php
echo <<< HTML
// your whole html page goes here
HTML; //this must be in the first column or it won't work...
?>
[/code]
Copy linkTweet thisAlerts:
@LordOfGoodauthorMay 09.2004 — ok thanks for the link as for what you wrote if i were to use that particular method would it have to go on every page?
Copy linkTweet thisAlerts:
@pyroMay 09.2004 — You don't [i]have[/i] to do anything special to have a page with a .php extention. Simply rename the documents with a .php extention, and they should work fine.

Using the heredoc syntax described in the above post to display your HTML code really doesn't make much sense. You can embed HTML directly into the PHP document.
Copy linkTweet thisAlerts:
@MstrBobMay 09.2004 — I did the same with my website not too long ago, and really the only thing I did was use php includes to simplify my life such as:

[code=php]<?PHP
include("header.txt");
?>

Page here

<?PHP
include("footer.txt");
?>[/code]


Header and footer.txt contained the full opening and closing of an html document, so it cut down on page size somewhat, although I guess one could do the same with SSI. :rolleyes: Eh, but I've also thrown in some interesting stuff such as a blog (in progress) counter, guestbook, and a forum (soon, maybe). Pretty much your basic stuff, though being able to make your very own is mondo kewlios.
Copy linkTweet thisAlerts:
@LordOfGoodauthorMay 10.2004 — Ok i understand where to go from here but what about the links?

wont they need to be changed when converted to php?
Copy linkTweet thisAlerts:
@GavinPearceMay 10.2004 — I think you answered it yourself. What about the links?

If you are just changing your page name from .htm/.html to .php and not doing any changes that require PHP at all, you are just wasting your time. Why have a php page that doesn't use any PHP, just HTML.

However yes, if you do change the pages from .htm to .php then yes links to page1.htm will have to be changed to page1.php

But I add again, unless you are using PHP scripting in your pages, why bother just renaming them?

I believe you might find these pages useful:

http://www.w3schools.com/php/default.asp
Copy linkTweet thisAlerts:
@NevermoreMay 10.2004 — This having to change links when your technology changes should tell you something. Read the article [URL=http://www.w3.org/Provider/Style/URI]cool URIs don't change[/URL] by Tim Berners Lee and, if applicable, the [URL=http://httpd.apache.org/docs/content-negotiation.html]Apache Content Negotiation reference[/URL].
Copy linkTweet thisAlerts:
@LordOfGoodauthorMay 10.2004 — Yes i do plan on using php scripting i intend on using the template system from my phpbb forum so that the site and forum look the same!

Thats why i needed to know how to convert my HTML version of my site into PHP!?
×

Success!

Help @LordOfGood spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...