e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
320 stars 214 forks source link

[Bug]: not able to set default image in theme config #5115

Open Jimmi08 opened 10 months ago

Jimmi08 commented 10 months ago

What e107 version are you using?

Latest Github version (just updated)

Bug description

I need the default image for theme config field

if I use this:

    <themePrefs>
        <artemis name="frontimage">{THEME}soft-ui-design-system/images/curved.jpg</artemis>
    </themePrefs>

it is trying to display:

<img class="image-selector img-responsive img-fluid" src="/e107233/e107_themes/bootstrap3/soft-ui-design-system/images/curved.jpg" alt="curved.jpg" width="206" height="190">

How to reproduce

No idea :) Maybe install Artemis theme?

Expected behavior

Use a frontend theme path.

There may be another shortcode for this. But theme name shouldn't be part of it.

Thanks

What browser(s) are you seeing the problem on?

Chrome / Brave

PHP Version

8.1

Moc commented 10 months ago

Shouldn't it be <pref name="... rather than <artemis name="...?

<themePrefs>
    <pref name="frontimage">{THEME}soft-ui-design-system/images/curved.jpg</artemis>
</themePrefs>
Jimmi08 commented 10 months ago

Shouldn't it be <pref name="... rather than <artemis name="...?

<themePrefs>
  <pref name="frontimage">{THEME}soft-ui-design-system/images/curved.jpg</artemis>
</themePrefs>

No, from install.xml it has different syntax., but this one works (only path is wrong). When you export theme prefs from Database/tools and you want to import them back, you need to use different syntax than in theme.xml. I suppose you can import data for more themes at once.
Weird, I admit.

By the way, it didn't work from theme.xml, probably because shortcode in value.

    <themePrefs>
        <pref name='frontimage'>{e_THEME}artemis/images/curved.jpg</pref>
    </themePrefs>

Finally, I used {e_THEME} in install.xml, but still... but the problem with using frontend theme stuff in the admin area stays.

Jimmi08 commented 9 months ago

@Moc
I tested:

theme_library.php

$libraries['bootstrap5']['library_path'] = '{THEME}';

it works.
If wouldn't; (f.e. wrong path, I would get this: image

{THEME} shortcode works in any HTML layout, template etc.

The only problem is if it is used in the image path. this works: {e_THEME}starter/images/settings_bs5_c.png but this not: {THEME}images/settings_bs5_c.png

So it is not a preference issue, but not possible to use this shortcode in the image path. But you can use it in the library path - this is why I am confused.