i-net-software / dokuwiki-plugin-siteexport

DokuWiki plugin to export pages or namespaces to static html
https://www.dokuwiki.org/plugin:siteexport
GNU General Public License v2.0
24 stars 12 forks source link

How to export the whole page seen in the browser (ie from a template) ? #116

Open gerardnico opened 3 years ago

gerardnico commented 3 years ago

Hallo,

This is more a question than an issue even if I don't really know if this is.

As of today, I tried to export statically a single webpage as I see it in the browser while navigating (meaning included sidebar, page header, page footer from a template).

It seems that the URL of the page exported looks like that (found at action/ajax.php line 578)

http://host/pageid?do=export_xhtml&template=mytemplate

It means then their is no use of the main.php file of the template and therefore we don't get the whole html page but only the generated content of the dokuwiki page (ie without the sidebar, etc ...)

Am I right ?

gerardnico commented 3 years ago

Hallo world ?

gamma commented 2 years ago

Sorry. not looking here all too often. The export will save the page as is, not only the body content. You could choose a different renderer for that though.

gerardnico commented 2 years ago

Thanks. No worry, I understand that this is not a high priority.

I dropped it and I find it too bad that it does not work just for a lack of documentation (there is a lot of work).

This is the URL that I got (Direct Download Link) when I want to export a single page (the root home page) actually.

http://local.lan/start?depth=0&depthType=0.0&do=siteexport&ens=start&exportLinkedPages=0&template=strap

And in the export, there is no sidebar, no header, nothing. The main.php file of the template seems to be not called at all. I don't get a breakpoint either also when debugging. That's why I took a look in the code and found that it was calling this:

http://host/pageid?do=export_xhtml&template=mytemplate

And this is actually what I got.

gerardnico commented 2 years ago

Just a side note, the default export value zipfilename (wiki:export.zip) will fail the export if the wiki namespace does not exist (you got no feedback from the ajax call on the admin page and an error with the download link)

Callstack

Warning: ZipArchive::close(): Failure to create temporary file: No error in D:\dokuwiki\lib\plugins\siteexport\inc\filewriter.php on line 115
Call Stack
#   Time    Memory  Function    Location
1   0.0005  432960  {main}( )   ...\doku.php:0
2   0.1612  15092088    act_dispatch( ) ...\doku.php:122
3   0.1616  15122648    dokuwiki\ActionRouter::getInstance( )   ...\actions.php:16
4   0.1616  15122744    dokuwiki\ActionRouter->__construct( )   ...\ActionRouter.php:60
5   0.1616  15123352    dokuwiki\ActionRouter->setupAction( )   ...\ActionRouter.php:48
6   0.1616  15123512    dokuwiki\Extension\Event->advise_before( )  ...\ActionRouter.php:80
7   0.1616  15123512    dokuwiki\Extension\EventHandler->process_event( )   ...\Event.php:76
8   0.1616  15123568    action_plugin_siteexport_ajax->siteexport_action( ) ...\EventHandler.php:81
9   0.1635  15129320    action_plugin_siteexport_ajax->__siteexport_add_site( ) ...\ajax.php:130
10  0.1636  15130480    action_plugin_siteexport_ajax->__getHTTPFile( ) ...\ajax.php:523
11  0.4430  15699008    action_plugin_siteexport_ajax->__getInternalLinks( )    ...\ajax.php:607
12  0.4430  15699448    preg_replace_callback ( )   ...\ajax.php:651
13  0.4431  15703192    action_plugin_siteexport_ajax->__fetchAndReplaceLink( ) ...\ajax.php:651
14  0.4435  15706568    action_plugin_siteexport_ajax->__fetchAndReplaceLinkFinish( )   ...\ajax.php:839
15  0.7746  15707600    siteexport_zipfilewriter->__addFileToZip( ) ...\ajax.php:1060
16  0.7746  15707600    siteexport_zipfilewriter->__writeFileToZip( )   ...\filewriter.php:86
17  0.8486  15707856    close ( )   ...\filewriter.php:115