Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken css/js files on individual shaare pages #11

Merged
merged 1 commit into from
Sep 6, 2020
Merged

Fix broken css/js files on individual shaare pages #11

merged 1 commit into from
Sep 6, 2020

Conversation

immanuelfodor
Copy link
Contributor

This PR fixes individual shaare pages (e.g., /shaare/o3Fv-w) as the relative path is no longer working:

image

@ilesinge
Copy link
Owner

ilesinge commented Sep 6, 2020

Thank you @immanuelfodor !

@ilesinge ilesinge merged commit 968c92e into ilesinge:master Sep 6, 2020
@ilesinge
Copy link
Owner

ilesinge commented Sep 6, 2020

Hey in fact it doesn't work for me in my production environment, the links end up being: //plugins/related/related.css and //plugins/related/related.js, which are translated by the browser as:
https://plugins/...
In order to remove the double slash, I end up having to modify the code:
$data['css_files'][] = ($data['BASE_PATH'] ?? '') . PluginManager::$PLUGINS_PATH . '/related/related.css'

Since it's a strategy used in other plugins, @immanuelfodor @ArthurHoaro do you know if my modification is correct or if it's my production environment that is somewhat broken ?

@immanuelfodor
Copy link
Contributor Author

Hmm, maybe you have something in your config.json.php that modifies the defaults? I think that is why your base path has became / instead of empty string (by default). Mine looks like:

<?php /*
{
    "resource": {
        "data_dir": "data",
        "config": "data\/config.php",
        "datastore": "data\/datastore.php",
        "ban_file": "data\/ipbans.php",
        "updates": "data\/updates.txt",
        "log": "data\/log.txt",
        "update_check": "data\/lastupdatecheck.txt",
        "history": "data\/history.php",
        "raintpl_tpl": "tpl\/",
        "raintpl_tmp": "tmp\/",
        "thumbnails_cache": "cache",
        "page_cache": "pagecache",
        "theme": "material"
    },
...
    "general": {
        "header_link": "\/",
...
    "plugins": {
        "_BASE_PATH_": "",
...

The last variable seems extremely suspicious to me :)

@ArthurHoaro
Copy link
Contributor

I'm sorry, I actually made a mistake in the other thread. The base path is added in the default template, so it's now added twice.

{loop="$plugins_footer.js_files"}
	<script src="{$base_path}/{$value}#"></script>
{/loop}

The last variable seems extremely suspicious to me :)

It looks like a bug, and I have the same thing in my local dev environment. Can you open an issue?

@immanuelfodor
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants