We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
Subscribe: RSS
  • It shouldn't matter, but this might solve it:

    [[!$head]]
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
    • Quote from: BobRay at Jan 22, 2014, 09:03 AM
      It shouldn't matter, but this might solve it:

      [[!$head]]

      Thanks, I will implement it and see how it works out over time!
      • Ok, the [[!$head]] helped me out, but doesn't solve the problem.

        The css and javascript files getting loaded now, but the page gets displayed like without them?!
        If have really no idea whats going on here, no php-errors, modx-errors or apache-errors.

        After clearing the cache everything is like as it should.
        Then, 2 weeks later or so, same problem. Page gets displayed without style, but css-files getting loaded.
        Clearing the cache "fixes" this again.

        I'm pretty sure that's a problem with the modx-cache.
        The cache-settings are on standard settings, no expiration times, modx-db-cache not in use.

        Does anyone have an idea whats going on here? [ed. note: fk_abs last edited this post 7 years, 11 months ago.]
        • Are you sure the paths to the css/js files aren't getting scrambled in the server configuration somewhere? If you get one of the bad pages, and view source, can you access the .css file by the path shown in the source?

          I have had problems with distributed and cloud servers that aren't quite configured properly, and the base path of the website varies. For example, what is today something like /home/sites1/username/www/ might next week be /home/sites2/username/www/.

          One time I had the server admins restore a rather old backup for the whole server without notifying any of the clients on the server. That was a mess. Fortunately I had a current backup for the site, and was able to restore it to a more current state.

            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
          • I was not able to to view the CSS files, however I noticed the base-tage was empty.
            I found this post from 5 years ago:
            http://forums.modx.com/thread/36226/css-and-cache-problem

            That's what you're talking about right?
            I hope it helps.

            The configs are fine jfyi.
            I will share the information if this little "fix" from the url above worked out for me, hopefully it helps someone else in the future then.
            • An empty base tag will certainly cause the problem. If you used site_url as the base, then this comes from the config.inc.php file. Generally it's set at installation, when the config.inc.php file gets generated.

              You can create a context setting for the web context, specifically setting the site_url so that it's constant. Or you can hard-code your full site URL for the base tag's attribute.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
              • Thanks, I hope this does the trick.
                • If have tracked it down and found what it was causing: the "/core/config/config.inc.php" file.
                  We all know that HTTP 1.0 requests come without a $_SERVER['HTTP_HOST'] and then, the $http_host variable in the config-file is empty, which causes this error.
                  Even if you set the base-url manually to your host, this alone will not to the trick unfotunately.

                  This little "quick and dirty" code did the trick:

                  /core/config/config.inc.php:

                  replace
                  65: $http_host = $_SERVER['HTTP_HOST'];
                  


                  with
                  65: $http_host = array_key_exists('HTTP_HOST', $_SERVER) ? $_SERVER['HTTP_HOST'] : 'your_http_host_here';
                  


                  Really weird that after that 1.0 request, I open the page with my browser (1.1 request) the $http_host still stays empty until I clear the cache.
                  Is it possible that the $http_host gets saved in the modx-cache?
                  • Yes, it becomes part of the $modx-config array which is cached.

                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                    • Ahhhh ok, that's why clearing the cache solved the problem.

                      Thank you for your answer ;-)