Closed Thread
Thread Tools Search this Thread
Unread 22nd Nov 2010, 02:11 PM   #1
Active Warrior
War Room Member
 
ProfJannes's Avatar
 
Join Date: 2010
Location: Cape Town; South Africa
Posts: 84
Thanks: 15
Thanked 4 Times in 4 Posts
Default
converting a php script to static executeable html file
Share on: 
fb share twitter share gplus share more share

I am currently working on a dynamic webpage, is it possible to generate html-files from this php-script that will load as the original php-script.
ProfJannes is offline  
Unread 22nd Nov 2010, 03:15 PM   #2
HyperActive Warrior
War Room Member
 
Tashi Mortier's Avatar
 
Join Date: 2010
Location: Hesse, Germany
Posts: 349
Thanks: 33
Thanked 82 Times in 64 Posts
Default
Re: converting a php script to static executeable html file
Share on: 
fb share twitter share gplus share more share

You could save the output of the .php Script and upload this file to the webserver.

You can't directly convert PHP into HTML.

Let me explain this: PHP is executed like a program on the webserver. It can read out entries from the database, even generate random numbers...

A HTML file is static and can not change anymore.

Is that really what you want?
Tashi Mortier is offline  
Unread 22nd Nov 2010, 03:20 PM   #3
Active Warrior
War Room Member
 
ProfJannes's Avatar
 
Join Date: 2010
Location: Cape Town; South Africa
Posts: 84
Thanks: 15
Thanked 4 Times in 4 Posts
Default
Re: converting a php script to static executeable html file
Share on: 
fb share twitter share gplus share more share

The reason i am asking, is that i want ot code a standard site template, but load it with different content, thus the php-script needed. The reason for HTML is that i want to sell these sites, without given awat my template...hope is makes sense
ProfJannes is offline  
Unread 22nd Nov 2010, 03:24 PM   #4
Web Developer
 
Join Date: 2010
Location: Wisconsin
Posts: 322
Thanks: 2
Thanked 80 Times in 74 Posts
Default
Re: converting a php script to static executeable html file
Share on: 
fb share twitter share gplus share more share

You would have to write another script (PHP) to save the output as an .html file.

Similar to a cacheing systems in forums, CMS's etc....

phpbbxpert is offline  
Unread 22nd Nov 2010, 03:25 PM   #5
HyperActive Warrior
War Room Member
 
Tashi Mortier's Avatar
 
Join Date: 2010
Location: Hesse, Germany
Posts: 349
Thanks: 33
Thanked 82 Times in 64 Posts
Default
Re: converting a php script to static executeable html file
Share on: 
fb share twitter share gplus share more share

Ah I see so you use PHP to generate the site you want to sell and PHP does something like include('header') include('footer') ?

Am I right?

Then you could simply save the website with your browser after it's displayed (html only)

And there you go the .html file will be the finished output.

edit:

If you have php installed locally and the php executable runs from the command line you can also do:

php script.php > output.html

Last edited on 22nd Nov 2010 at 03:26 PM. Reason: Added tip
Tashi Mortier is offline  
Unread 22nd Nov 2010, 03:49 PM   #6
HyperActive Warrior
 
Join Date: 2010
Posts: 347
Thanks: 24
Thanked 20 Times in 20 Posts
Default
Re: converting a php script to static executeable html file
Share on: 
fb share twitter share gplus share more share

Use a web site crawler to save your site in HTML format.

gtk29 is offline  
Unread 22nd Nov 2010, 10:45 PM   #7
HyperActive Warrior
War Room Member
 
Join Date: 2009
Location: Sydney, Australia
Posts: 297
Thanks: 8
Thanked 34 Times in 29 Posts
Default
Re: converting a php script to static executeable html file
Share on: 
fb share twitter share gplus share more share

I've done something like this for a website that does 3million unique's a month (it's a real estate portal!).

Best way to do it (in a very simple high level overview)

1) load ob_start() function
2) generate output
3) use ob_get_contents() function to get the generated html
4) save the contents of ob_get_contents() to a static file (ie subject-story-1.html)

If you do this in a systematic way, you'll be able to generate entire static sites on the fly.
powerspike is offline  
Unread 23rd Nov 2010, 12:41 AM   #8
Active Warrior
War Room Member
 
ProfJannes's Avatar
 
Join Date: 2010
Location: Cape Town; South Africa
Posts: 84
Thanks: 15
Thanked 4 Times in 4 Posts
Default
Re: converting a php script to static executeable html file
Share on: 
fb share twitter share gplus share more share

Many thanks
ProfJannes is offline  
Closed Thread


Bookmarks

Tags
converting, executeable, file, html, php, script, static

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 01:41 PM.