hii all,
i developed a shopping cart which has many features like grid view,list view and floating cart which is also dragable.now my problem is its taking to much time to load becoz of conditions and images
now,i want to generate html pages of my php pages,i dont want url rewriting using .htaccess but whole content of dynamic page in static html page
any suggestions?
thank u

Do you mean that you want to convert all your php documents into html documents or are you trying to place php content under a .html extension. If you are trying to convert all the php documents to html documents then the following script will do the job although you will need to specify each php location in the array.

<?
$links=array(
'index.php',
'index.php?id=1',
'data.php',
'folder/phpfile.php?id=43');
//set the links in the array above
foreach ($links AS $link) {
$data=file_get_contents($link);
file_put_contents(str_replace(array('?','*',':','|','"',"'"),'_',$link).'.html',$data);
unset($data);
}
echo 'process complete.';
?>

If however you want to keep them as php files but want to give them a .html extension without .htaccess files then you could modify apache to treat html files as php files and just leave the extension .htm (not .html) for the regular html files.

Just one
you seem to misunderstand what you are doing
the site will no longer function.
processing of the order
inventory control etc
must react to user input so cannot be static html.

thank u for replies ,
cwarn23 u got it right i want to convert my php documents to html documents i tried ur code but it is not execting my php code and i can see all my php code in browser source.
bob i think there is nothing problem in doing so, as i think if user posts data then server will give responce execute my php code and returns my converted static pages to user

I just tested the script for the bug you mentioned and have now got a fix and the code is as follows:

<?
$domain='http://example.com/'; //must end in a slash
$links=array(
'index.php',
'index.php?id=1',
'data.php',
'folder/phpfile.php?id=43');
//set the links in the array above
foreach ($links AS $link) {
$data=file_get_contents($domain.$link);
file_put_contents(str_replace(array('?','*',':','|','"',"'"),'_',$link).'.html',$data);
unset($data);
}
echo 'process complete.';
?>

However, with the change in the code, in the domain variable on the second line you will need to specify your website domain and all the links in the array below that will need to be relative to the homepage directory. Hope that helps.

php returns static html pages
nothing else is seen on the user browser, unless part of the html is a javascript, then the javascript is dynamic (from the user perspective)
Trying to get my head round how what you want could not be solved with a mod_rewrite rule, with lower overheadI might (grimace(probably)) be missing somethingbut I guess my learning curve isnt helping your problem, sorry

php returns static html pages
nothing else is seen on the user browser, unless part of the html is a javascript, then the javascript is dynamic (from the user perspective)
Trying to get my head round how what you want could not be solved with a mod_rewrite rule, with lower overheadI might (grimace(probably)) be missing somethingbut I guess my learning curve isnt helping your problem, sorry

I managed to get my head around the problem with a simple question. What if php in this case does no processing and only displays multiple pages based on url input? That is the theorm my script works on. So to some degree you would then convert the usage of if(/*blah*/$_GET/*blah*/) to html. It is only things like $_POST, mysql input and mail() that won't process. So there are 2 answers to your question depending on what your using php for.

Thankyou Cwarn23, straightens the kinks a little
Rob

only a little

Ancora Imparo

thank u very much for your code,its working fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.