webodf / ViewerJS

ViewerJS: Document Reader in JavaScript
http://viewerjs.org
1.94k stars 419 forks source link

Wordpress plugin doesn't work out of the box #74

Closed tieguy closed 10 years ago

tieguy commented 10 years ago

The wordpress plugin didn't work on install for me.

Happy to report this problem elsewhere if this isn't the right place for bugs against the WP plugin!

kossebau commented 10 years ago

Is the right place to file :) Partially fixed with #71 (for the location of the files), no idea about the .htaccess, hopefully someone with more clue can fix that/comment on that.

tieguy commented 10 years ago

At least on Apache, you need:

DirectoryIndex index.html

In your .htaccess (or equivalent Apache configuration) for the /# URL scheme that the plugin uses to work.

Options to make that work globally (but I'm not an expert in this stuff!)

  1. Hardcode index.html# in the URL, instead of relying on the web server to redirect / to index.html
  2. Ship a .htaccess file that contains "DirectoryIndex index.html". This will work in a default Apache configuration (I believe) but may not work in more hardened/non-default Apache configs that turn off per-directory .htaccess files.
vandenoever commented 10 years ago

So two tasks are needed in my opinion to make the first-time user able to sort themselves out more easily:

tieguy commented 10 years ago

The more I think about it, the more I think it might just be more robust to change the first line of viewerjs-plugin.php to: $viewerjs_plugin_url = plugins_url() .'/'. plugin_basename(dirname(__FILE__).'/index.html'); i.e., hardcode "index.html" at the end. That should work on any webserver without configuration. (I've tested locally, at least, and it works even after I revert yesterday's Apache config change.)

vandenoever commented 10 years ago

On 07/23/2014 09:32 PM, Luis Villa wrote:

The more I think about it, the more I think it might just be more robust to change the first line of viewerjs-plugin.php to: |$viewerjs_plugin_url = plugins_url() .'/'. plugin_basename(dirname(FILE).'/index.html');| i.e., hardcode "index.html" at the end. That should work on any webserver without configuration.

You are right, that is easier and avoids the need for documentation and confusion.

kossebau commented 10 years ago

Thanks again for the report, tieguy.

A new release was tagged today which should contain the fixes for this issue, so closing it. Please find the released wordpress plugin already at http://viewerjs.org/releases/viewerjs-wordpress-0.5.2.zip (website pages still need the updated links to be pushed in, should happen during the WE, latest Monday), hopefully it will be more useful to you :) (also brings some ODP rendering improvements)

Please reopen this issue if there are still problems.

tieguy commented 10 years ago

Tested the new build and it works like a charm - thanks!