I'm modifying the John S template for use on my site and ran across a bug that others may want to know about.

The "Template background" setting that appears on the "Basic settings" tab of the "Edit style" page doesn't seem to do anything if you choose either "White Background" or "Dark Background" as the setting. These options correspond to the "light_bg" and "dark_bg" values in the templateDetails.xml, which correspond to the ".light_bg" and ".dark_bg" classes in several stylesheets. Unfortunately, the code does not produce these classes correctly.

The code prepends the string "pattern" to create the CSS classes for the various background patterns that the template makes available, e.g. "pattern1", "pattern2", etc. That's not a problem. Unfortunately, though, the string also gets prepended to the values for the light and dark backgrounds, so the stylesheets should refer to ".patternlight_bg" and ".patterndark_bg" or the background color will not be applied as expected. Either that, or the code should be fixed so that the "pattern" string will not be prepended when either "light_bg" or "dark_bg" are selected.

    Dominion Hi

    I tried to change the background but it still works fine when switching white / dark background.

    You can share the URL + super admin account so I can take a look.

    I cannot share the URL as I'm working on a local dev server you can't reach.

    Generally speaking I'm not a fan of asking for admin access as the first step to solving problems, as it's often the case that the issue is something that can't be discovered without changing server settings, etc., that is not possible on a production server environment. This issue is a case in point:

    I did some further testing and discovered the cause of the problem. I just reproduced the problem with a fresh install of your Quickstart package for J4, which ships with Jooma 4.2.4. With no other settings altered, I found both the "White Background" and "Dark Background" settings have no effect: they both result in the same subtle pattern seen with the "None" setting.

    Then I tried changing my PHP version from 8.0 to 7.4 and the problem went away. So I'm guessing you tested it with an older version of PHP, perhaps?

      Dominion You are right, I tested with PHP 7 so it worked properly. I'm looking into it with PHP 8

      Thank you. I should have tried testing with a different version of PHP before posting, but it was such a subtle problem and I hadn't seen any other issues with PHP 8.0, so it didn't occur to me.

      I look forward to hearing your results.

      You can backup this file:

      ROOT/templates/gk_john_s/layouts/default.php

      and replace with attached file (unzip first)


      defaultphp.zip
      4kB

      Thank you. I thought the >= 1 looked a bit unnecessary there.

      I won't actually be using these values as I'm customizing the background of my site in a different manner. But I'm sure some other users may be happy if this change is added to a future update of the template. Thanks again!

        There's a small problem with the second line you changed:

        $this->page_suffix .= ' pattern ' . $this->API->get('template_pattern', 'none');

        Adding a space after the pattern string causes the code to add two classes ( pattern 3) instead of one (pattern3), which prevents the patterns from being displayed.

        A better approach to this might be to separate the background color and the background pattern (image) into two separate settings. The former setting could offer a palette of colors, similar to the "Template color" setting.

          Write a Reply...
          You need to Login to view replies.