We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38850
    • 110 Posts
    Hi, this question has been asked once or twice according to Google, but I've still not found the solution.

    I downloaded a brand new fresh copy of Modx, install it, made a quick template for testing and one resource page for the home page.
    So far so good.
    Next I installed Articles so I could have a blog-style section of my site, this installed some extra templates and chunks and all that, fine. But when I go to change a blog resource to the article template, the page refreshes and sets the original template again.

    This sent me on a two hour search all over the Internet trying to get this silly program to let me select a different template and I can't! arrrrrrrrrrg!
    I can't delete my original template because it says it's in use. I can't change the existing resources to a new template because it keeps refreshing and setting the old one again.

    I did find this bug report:
    http://tracker.modx.com/issues/6589

    There may be another bug report or two but they don't say what the issue is and how to fix it! Yet it says the bugs are "resolved"! Obviously not, since I have this issue with a brand new install right off the home page that I downloaded 2 days ago.

    There was something about PHP and timezone's, I have no idea what the timezone has to do with picking a different html template but whatever, I changed the timezone to UTC to match php.ini and that didn't fix it either.
    I found these five updated files for the articles package that supposedly had something to do with this, that didn't fix it.

    Now I'm just wasting time with this brand new software that doesn't even work. Why can't I change the flippin templates!

    Somebody please come up with a solution or Modx is off the table as a possible CMS for our business, can't waste any more time trying to fix it before I've even done anything complicated with it!

    Thanks!

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 10208 ☆ A M B ☆
      • 1,780 Posts
      Use the PHP timezone value in the MODX manager's settings. It's in the system and server area, (or search "timezone", it'll pull it right up). Then find your timezone value here: http://php.net/manual/en/timezones.php

      Enter the value from that list that best matches your mySQL and server timezone settings into the MODX default_timezone field.

      For example, for PST I use America/Los_Angeles in the MODX manager's settings.

      The template changing actually has plenty to do with the timezone, due to the fact that MODX uses a temporary value to hold the new template until you save the resource. So, if that's not set the same as mySQL and your server's settings, it can't save the new template temporarily.

      I don't think this is considered to be an actual bug, and that's why it's marked solved when it doesn't seem to be. Making sure that all the timezone settings match in value is the key, including setting the manager timezone with the correct PHP value.
        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
      • discuss.answer
        • 3749
        • 24,544 Posts
        Sorry for your trouble. It's almost certainly the date_timezone setting in the MODX System Settings table. It has to match exactly the setting in all the other places. This will be handled better in the next release.

        As a workaround, you can right-click on the resource in the tree and select "Quick Update Resource". If you change the template there and press "Save" it will stick.


        ---------------------------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
        MODX info for everyone: http://bobsguides.com/modx.html
          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
          • 38850
          • 110 Posts
          Okay but that's exactly what I did. The php.ini timezone says "UTC", so I put "UTC" in the modx settings.

          Something else? Need to do it differently?
          • discuss.answer
            • 32316
            • 387 Posts
            its the mySQL server setting that it has to match
            I believe I and others wrote about in this thread https://forums.modx.com/thread/73018/2-2-0-pl2-cannot-change-template-on-new-resource-console-errors?page=6#dis-post-413847


            edit to make clear:
            php and mysql have to agree on the the time for things to work.
            The setting available in the modx manager takes care of the php bit, the trick is knowing/finding out what the mysql server is set to especially if you in a shared hosting environment. [ed. note: whistlemaker last edited this post 14 years, 7 months ago.]
              • 38850
              • 110 Posts
              mysql timezone setting is different.

              I went ahead and removed UTC as the TZ and instead used the standard notation "America/Phoenix" for both PHP and Modx. This actually finally worked!!

              The MySQL setting, by contrast, is actually "Mountain Standard Time". Since that is basically the same timezone, perhaps that's why it worked?

              Strange issue, I'll have to make sure all three products have matching timezones if this gets deployed to an outside server. As of now it's just in my dev environment.

              Hopefully this helps any other web searchers fix their issues!
                • 32316
                • 387 Posts

                The MySQL setting, by contrast, is actually "Mountain Standard Time". Since that is basically the same timezone, perhaps that's why it worked?

                yep that's why it worked.

                I've edited my previous comment to hopefully make it clearer.