2011-07-20, 05:26:37
@dominionit
Hey, it was just an idea... :-) No hurry...
Just in case this helps (you or anyone interested): a year ago I experimented with something similar. I started a very basic plugin (but like you, my children don't let me develop everything I'd like) verysimplestatic.php:
You have to set Custom permalink structure to:
It's a different approach, only for generating local copies. (note it's very half-made)
Hey, it was just an idea... :-) No hurry...
Just in case this helps (you or anyone interested): a year ago I experimented with something similar. I started a very basic plugin (but like you, my children don't let me develop everything I'd like) verysimplestatic.php:
Code:
<?php
$thisfile = basename(__FILE__, ".php");
register_plugin(
$thisfile,
'VerySimpleStatic',
'0.1 beta',
'Carlos',
'#',
'Save copies of GS pages as static html (permalink structure in Setup should also be edited)'
);
// CHANGE NEXT LINE TO SET YOUR PREFERRED FILE EXTENSION:
define(VERYSIMPLESTATIC_EXT,'html'); // .htm, .html ... anything but 'php'
define(VERYSIMPLESTATIC_RELPATH,'staticfolder/'); // RELative path, ending in a slash
add_action('edit-content', 'verysimplestatic');
function verysimplestatic() {
global $url;
global $update;
if ($update == 'edit-success'){ verysimplestatic_writepage(@$url); }
}
function verysimplestatic_writepage($slug) {
global $SITEURL;
$s=file_get_contents($SITEURL.'/index.php?id='.$slug);
$filename=GSROOTPATH.VERYSIMPLESTATIC_RELPATH.$slug.'.'.VERYSIMPLESTATIC_EXT;
$fich=fopen($filename,'w');
if( fwrite($fich, $s) ) {
echo 'File '.$filename.' created/updated.';
} else {
echo "ERROR writing static page! ($filename)<br>";
}
fclose($fich);
}
You have to set Custom permalink structure to:
Code:
staticfolder/%slug%.html
It's a different approach, only for generating local copies. (note it's very half-made)