diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-25 10:59:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-25 10:59:40 +0200 |
commit | 85b972baf67c61ebabf1ce332358e4dfd2456a4e (patch) | |
tree | 6f890cf93ac6cd30da509fa9c39ec7d061f25709 /doc/md | |
parent | 71eb87353ca09a1476c3f94e51ccfbfb45a91170 (diff) | |
parent | 76fe68d924d424283d0a1784c5f5e7582dda3a00 (diff) | |
download | Shaarli-85b972baf67c61ebabf1ce332358e4dfd2456a4e.tar.gz Shaarli-85b972baf67c61ebabf1ce332358e4dfd2456a4e.tar.zst Shaarli-85b972baf67c61ebabf1ce332358e4dfd2456a4e.zip |
Merge pull request #1558 from ArthurHoaro/fix/plugins-base-path
Fix plugin base path in core plugins
Diffstat (limited to 'doc/md')
-rw-r--r-- | doc/md/dev/Plugin-system.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/md/dev/Plugin-system.md b/doc/md/dev/Plugin-system.md index a87bd0cf..c29774de 100644 --- a/doc/md/dev/Plugin-system.md +++ b/doc/md/dev/Plugin-system.md | |||
@@ -139,6 +139,20 @@ Each file contain two keys: | |||
139 | 139 | ||
140 | > Note: In PHP, `parse_ini_file()` seems to want strings to be between by quotes `"` in the ini file. | 140 | > Note: In PHP, `parse_ini_file()` seems to want strings to be between by quotes `"` in the ini file. |
141 | 141 | ||
142 | ### Understanding relative paths | ||
143 | |||
144 | Because Shaarli is a self-hosted tool, an instance can either be installed at the root directory, or under a subfolder. | ||
145 | This means that you can *never* use absolute paths (eg `/plugins/mything/file.png`). | ||
146 | |||
147 | If a file needs to be included in server end, use simple relative path: | ||
148 | `PluginManager::$PLUGINS_PATH . '/mything/template.html'`. | ||
149 | |||
150 | If it needs to be included in front end side (e.g. an image), | ||
151 | the relative path must be prefixed with special data `_BASE_PATH_`: | ||
152 | `($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH . '/mything/picture.png`. | ||
153 | |||
154 | Note that special placeholders for CSS and JS files (respectively `css_files` and `js_files`) are already prefixed | ||
155 | with the base path in template files. | ||
142 | 156 | ||
143 | ### It's not working! | 157 | ### It's not working! |
144 | 158 | ||