diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-10-16 13:06:06 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-10-16 13:06:06 +0200 |
commit | 3adbdc2a83e6b77a4ca62094c5d857524e39d211 (patch) | |
tree | 5e6dd92c7e47edeb4f2917f7718ad7ad7113e23f /doc/md/dev | |
parent | 7f5250421be4832b9679d8140bc4a71c8005dfa3 (diff) | |
download | Shaarli-3adbdc2a83e6b77a4ca62094c5d857524e39d211.tar.gz Shaarli-3adbdc2a83e6b77a4ca62094c5d857524e39d211.tar.zst Shaarli-3adbdc2a83e6b77a4ca62094c5d857524e39d211.zip |
Inject ROOT_PATH in plugin instead of regenerating it everywhere
Diffstat (limited to 'doc/md/dev')
-rw-r--r-- | doc/md/dev/Plugin-system.md | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/md/dev/Plugin-system.md b/doc/md/dev/Plugin-system.md index c29774de..f09fadc2 100644 --- a/doc/md/dev/Plugin-system.md +++ b/doc/md/dev/Plugin-system.md | |||
@@ -148,11 +148,16 @@ If a file needs to be included in server end, use simple relative path: | |||
148 | `PluginManager::$PLUGINS_PATH . '/mything/template.html'`. | 148 | `PluginManager::$PLUGINS_PATH . '/mything/template.html'`. |
149 | 149 | ||
150 | If it needs to be included in front end side (e.g. an image), | 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_`: | 151 | the relative path must be prefixed with special data: |
152 | `($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH . '/mything/picture.png`. | 152 | |
153 | * if it's a link that will need to be processed by Shaarli, use `_BASE_PATH_`: | ||
154 | for e.g. `$data['_BASE_PATH_'] . '/admin/tools`. | ||
155 | * if you want to include an asset, you need to add the root URL (base path without `/index.php`, for people using Shaarli without URL rewriting), then use `_ROOT_PATH_`: | ||
156 | for e.g | ||
157 | `$['_ROOT_PATH_'] . '/' . PluginManager::$PLUGINS_PATH . '/mything/picture.png`. | ||
153 | 158 | ||
154 | Note that special placeholders for CSS and JS files (respectively `css_files` and `js_files`) are already prefixed | 159 | 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. | 160 | with the root path in template files. |
156 | 161 | ||
157 | ### It's not working! | 162 | ### It's not working! |
158 | 163 | ||