I’m not sure whether I’m posting this in the right forum:
When exporting a site to static html I found it useless, that MODx exports internal links as "index.php?id=123" and image links are exported as absolute links ("
http://yoursite...")
So I added two lines after line #113 in "export_site.static.action.php" to
- rewrite index.php?id=123 to [Exportprefix]123[Exportsuffix]
- export image refs as relative links (src="images/youpic.gif"
// PP make links relative
$buffer = str_replace("http://localhost/modx/assets/", "", $buffer);
// PP rewrite index.php links PP
$buffer = eregi_replace("(index.php\?id=)([0-9]+)", "$prefix\\2$suffix", $buffer);
Maybe other users find this useful too.
There’s only one thing missing: I couldn’t find a global variable for the modx-URL (localhost in the example), so this code works only on local installations with no subdirectories. Maybe one of the developers can provide this missing var?
And the second thing is: If aliases are used, MODx names exported html-files using the alias, not the ID.
Aliases are a bit harder to detect using a regex, may be I will do it, if someone needs it. I do not use aliases and haven’t understood their purpose, to be honest..
BTW: I’m impressed by the clean, well structured code of MODx, tweaking it is almost a snap, even for a non-experienced amateur like me!