But there is a way to avoid the stack by generating static content. As far as I know, Joomla doesn't really support this since there are very dynamic features with it which wouldn't make sence to run statically.
All you need to do is to point a web site grabber on your joomla root and to make it work. But, all free grabbers I've tested either have generated smth. fully unuseful outcome or simply stopped working. Then, I've decided to do it classic way using the UNIX wget tool. Here is the result:
1. Create a web site with a locally installed Joomla omitting all that really dynamic stuff but using articles only (for server installation, just modify the host and the shares I use here)
2. If on Windows, use Cygwin, If not so or even so, you need some modifications to the following script to use your local paths. For the script to run, you need Perl
3. Here is the script:
#!/usr/bin/perl
$dir = "/cygdrive/c/xampp/htdocs/
$tmpl = "/cygdrive/c/xampp/htdocs/joomla/templates/YOURTEMPLATE
$sys = "/cygdrive/c/xampp/htdocs/joomla/templates/system/html/";
#let wget dance
system("cd $dir; rm -rf *; wget -r -x -p -nH -k -nd -E localhost/joomla/");
#do some post modifications
opendir __DIR, "$dir";
@files = readdir __DIR;
#iterate over the generated files
foreach $file (@files) {
#we're only interested in CSS files
if ($file =~ m/^.*\.css$/is) {
open _F, "<$dir/$file"; $tmp = join "", <_f>;
#find all referenced images and rewrite the reference. Also copy the image from the template
while ($tmp =~ m/url\((\.\.\/images\/{0,1}[^\)]*?\/)(.*?)\)/is) {
system("cp $tmpl$1$2 $dir");
system("cp $sys$1$2 $dir");
$fn = $2;
$fn =~ s/.*\/(.*)/$1/is;
system("chmod 644 $dir/$fn");
$tmp =~ s/url\(\.\.\/images\/{0,1}[^\)]*?\/(.*?\))/url($1/is;
}
close _F;
open _F, ">$dir/$file";
print _F $tmp;
close _F;
}
}
closedir __DIR;
#do ftp upload
system("lftp -f ftp.txt");
4. Modify paths and extend the script to also copy your images and other stuff. I use a flat target directory, so some modifications are also necessary to work with a subfolder structure.
5. ftp.txt contains the upload commands for lftp
That's it.
No comments:
Post a Comment