Current location: Hot Scripts Forums » Programming Languages » PHP » converting .php driven site to .html?


converting .php driven site to .html?

Reply
  #1 (permalink)  
Old 06-24-04, 04:20 PM
treyerice treyerice is offline
New Member
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question converting .php driven site to .html?

Does anyone know if there is a program or script available that can convert a website consisting of .php webpages and stored in MySQL database to a 'static' .html site?

Thanks for any other suggestions too.

Treye

Last edited by treyerice; 06-24-04 at 04:28 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-24-04, 05:56 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Location: Michigan
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
nope not posible. but why would you want to make a php site into a html 1?

they might be a software but i think its costly, then again im dont think thats at all possible.

just sounds odd you would want a basic webpage
__________________
Elite Bulletin Board
http://elite-board.us
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-24-04, 06:43 PM
Rapid Dr3am Rapid Dr3am is offline
Community VIP
 
Join Date: Jan 2004
Location: Liverpool, England
Posts: 752
Thanks: 0
Thanked 0 Times in 0 Posts
Pretty simple really.
In your .htaccess put this

Code:
AddType application/x-httpd-php .php .htm .html
__________________
Placeholder, place signature here.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-24-04, 06:50 PM
hack adept hack adept is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Rapid Dr3am
Pretty simple really.
In your .htaccess put this

Code:
AddType application/x-httpd-php .php .htm .html
Addition to Rapid Dr3am's post, you need to rename all files with a .php extension, to .html.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 06-24-04, 06:56 PM
Rapid Dr3am Rapid Dr3am is offline
Community VIP
 
Join Date: Jan 2004
Location: Liverpool, England
Posts: 752
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry, I thought that was pretty obvious.
It just allows you to put PHP in your html files.
__________________
Placeholder, place signature here.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 06-24-04, 07:02 PM
hack adept hack adept is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Rapid Dr3am
Sorry, I thought that was pretty obvious.
It just allows you to put PHP in your html files.
Well, you never know how stupid some people are. (Not saying you are treyerice)

But, technically, it's just cloaking the filename, not allowing PHP in HTML documents. But I'll be quiet now...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 06-25-04, 05:04 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
Quote:
Originally Posted by Rapid Dr3am
Pretty simple really.
In your .htaccess put this

Code:
AddType application/x-httpd-php .php .htm .html
I think he meant creating new HTML files out of php files so they are static and don't need to connect to database and do processing and other php stuff! not allowing HTML files to be preprocessed with php!

doing this wouldn't be easy! you have to store all contents of the page and then save them into a file with fopen(), fwrite() and fclose() !
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 06-25-04, 05:18 AM
sufyan sufyan is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Melbourne, AU
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
A simple script I wrote awhile back.

PHP Code:

<pre>

<?php
function update($cFile) {
    
$script str_replace(".html""_script.php"$cFile);
    
$filename "/home/user/public_html" $cFile//replace this with the absolute path to your root web folder eg. htdocs, etc.
    
$myFile fopen($filename,'w+');
    if (!
$myFile){
        print (
"File could not be opened.");
        exit;
    }
    
$string shell_exec("/usr/bin/curl -L http://www.yoursite.com" $script);
    
//$string = str_replace("\t", "", $string); //any replacements
    //$string = str_replace("\n", "", $string);
    //$string = str_replace("  ", "", $string);
    
fputs($myFile$string);
    
fclose($myFile);
    echo 
"Updated - " $cFile "\n";
}

# IMPORTANT: Must have leading slash

//example: the following would convert index_script.php (dynamic) to index.html (static)
update("/business/wholesalers/index.html");
//have as many as you want
update("/dir1/file2.html");
//would make [url]http://yoursite.com/index.html[/url] from [url]http://yoursite.com/index_script.php[/url] 
update("/index.html");

echo 
"\nUpdate Complete " date("h:i A \G\M\T O"Time());
?>
</pre>
EDIT:
Note: The .html file must exist and must be writable (666)

Last edited by sufyan; 06-25-04 at 05:21 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 06-25-04, 08:24 AM
Infinite_Hackers's Avatar
Infinite_Hackers Infinite_Hackers is offline
Coding Addict
 
Join Date: Dec 2003
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by NeverMind
I think he meant creating new HTML files out of php files so they are static and don't need to connect to database and do processing and other php stuff! not allowing HTML files to be preprocessed with php!

doing this wouldn't be easy! you have to store all contents of the page and then save them into a file with fopen(), fwrite() and fclose() !
If your correct, how about view source code of the php (not relative, HTTP way, so you will get the html and not the actual php code ) file and write the code to an .html file?
__________________
New beta project: GFX-PRO.ATH.CX
Description: GFX-PRO a great new project that anyone can and setup in less then a minute. [ More info ]
Website: http://gfx-pro.ath.cx
Status: Online
http://gfx-pro.ath.cx/sig.png
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #10 (permalink)  
Old 07-06-04, 08:14 AM
treyerice treyerice is offline
New Member
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Sufyan,
Thanks for replying to my question about converting .php web pages into static .html pages.

I will try to use your script. I am still a newbie when it comes to .php...hopefully will learn quick.

Thanks,
Treye Rice
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accepting bids for hosting site re-design and ModernBill setup/integration SN-Coach Job Offers & Assistance 9 04-28-04 09:52 AM
Database Driven Site techknow Job Offers & Assistance 3 04-12-04 12:29 AM
converting CGI/Perl site to PHP lordmerlin PHP 7 08-03-03 07:01 AM
Use PHP to download .html file from another site (Like LWP::Simple in Perl) ? kevin PHP 4 07-03-03 02:57 AM


All times are GMT -5. The time now is 07:20 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.