We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40145
    • 5 Posts
    Hello, I am new to modx, just started using it yesterday. I have 4 domains being used by one modx install with one mysql database. I followed the instructions here to get the 4 domains in my account:

    http://www.belafontecode.com/modx-revolution-hosting-multiple-domains/

    I got it all working good. But now I am having a serious problem. It seems no matter what, every page I create on any of the domains will always point to the first template I created. I have created 4 templates in the elements section, but even if I choose to have a page use a different template it always just uses the first one I created. I tried fiddling around the settings for hours but no luck!

    How can I make it so I can use what ever template I want for any page?

    Thank you!
      • 3749
      • 24,544 Posts
      That usually means a problem with your date/timezone setting. As a workaround, you should be able to change the template by right-clicking on the resource in the tree and selecting "Quick Update Resource"

      Which version of MODX are you using?



      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      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
        • 40145
        • 5 Posts
        I see. I am using version 2.2.2 revo

        How do I change the time zone settings in modx? I would think I would have to change it so it matches my php/mysql settings, right?

        Also I see in the php MyAdmin thing on hostgator, it reads:
        system time zone: CDT
        time zone: SYSTEM

        When I do a phpinfo check it reads:
        Default timezone: America/Chicago
        date.timezone: no value


        I remember when I installed modx I used EST time zone. I have no idea how to change the modx time zone now!

        BTW, the quick update does not work for me, it still uses the first template I made! Arggg! [ed. note: couvier last edited this post 14 years, 4 months ago.]
          • 3749
          • 24,544 Posts
          There is a date_timezone System Setting.

          Go to System -> System Settings and type 'timezone' in the search box at the upper right. If it's already set, i'd try leaving it blank for the first try. Be sure to clear the cache after every change.

          Google MODX date_timezone for info on setting the other date/timezone settings.

          Sorry, Quick Update used to work for that, I guess it no longer does.

          In the meantime, you should be able to set the template of any resource with this snippet (you'll have to know the resource ID and the template ID -- both in parentheses in the tree at the left -- and set them in the snippet tag).

          [[!SetTemplate? &resourceId=`12` &templateId=`33`]]



          /* SetTemplate snippet */
          
          $res = $modx->getObject('modResource', (integer) $scriptProperties['resourceId']);
          if ($res) {
            $res->set('template', $scriptProperties['templateId']);
            $res->save();
            $output =  'Set Template';
          } else {
            $output = 'Error - could not get resource';
          }
          return $output;
          



          You could also edit the resource's row in the modx_site_content table in the DB with PhpMyAdmin and set the template field to the desired template ID.




          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          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
            • 40145
            • 5 Posts
            I still can't figure this out! I've tried so many different settings for the timezone setting, nothing works. Ive tried googling modx date_timezone for more info but looked every where and cant find anything.

            I've been trying to use the snippet thing but have not yet got that to work.

            "You could also edit the resource's row in the modx_site_content table in the DB with PhpMyAdmin and set the template field to the desired template ID."

            Just to let you know, I have about 700 pages that I would need to convert into modx, are you telling me I have to manually do that for every page?

            I dont know, Ive been trying to get another template to work now for a straight solid 10 hours, I am so stressed out now, Im off to sleep..

            I do appreciate the help, but why does it have to be this hard???? [ed. note: couvier last edited this post 14 years, 4 months ago.]
              • 1343 ☆ A M B ☆
              • 2,213 Posts
              Hello,

              You likely need to set the date/timezone in a custom php.ini file and/or have your host change the main file for you.
                Patrick | Server Wrangler
                About Me: Website | Tweets |  MODX Hosting
                • 40145
                • 5 Posts
                I just successfully changed the date.timezone in the php.ini file to the timezone of: America/Chicago

                And that did change the date.timezone on my phpinfo correctly. As seen here on one of my domains:
                http://www.joanasworld.com/phpinfo.php

                And I updated the system settings in modx to: Default Time Zone - date_timezone - America/Chicago

                Then I cleared cache, and guess what? It still does NOT work! I cannot use more than the first template I made!

                Just so you know here is my modx system settings for timezone:
                key:
                date_timezone

                name:
                setting_date_timezone

                Description:
                setting_date_timezone_desc

                Field Type:
                textfield

                Namespace:
                core

                Area Lexicon Entry:
                system

                Value
                America/Chicago
                I also tried (with quotes): "America/Chicago"

                Also, if it helps any, I am getting this message when changing templates:

                Are you sure you want to change the Template?

                WARNING: This will only temporarily store your prior changes and reload the page; ensure you are ready to do so before proceeding. After the page has reloaded, you will need to save when you are ready to save the Template change.


                Any more ideas? [ed. note: couvier last edited this post 14 years, 4 months ago.]
                  • 19369
                  • 1,098 Posts
                  There is a big topic about this issue: https://forums.modx.com/thread/73018/
                    • 18373 ☆ A M B ☆
                    • 3,141 Posts
                    If the issue persists when using quick update, it's probably not the timezone issue. Plus I'm pretty sure most issues with that were fixed in 2.2.1 or 2.2.2.

                    When you change a template, does the dropdown change too, or does it jump back to the default one when you refresh the page?
                      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                      • 10208 ☆ A M B ☆
                      • 1,780 Posts
                      When you cleared the cache, did you delete the files in core/cache or did you do it within the manager?

                      Try this snippet from Whistlemaker.


                      A simple snippet for testing that will display:

                      • What time php thinks it is[li]
                        [li]What time mySQL thinks it is
                      • What timezones are set for the mySQL server
                      • and session (if different)


                      It assumes you have not moved the core.

                      <?php
                      //get the values we need to log into the mySQL server with
                      include 'core/config/config.inc.php';
                        
                      //php date
                      $arr['php'] = date("F j, Y, g:i a");
                        
                      //mysql
                      $link = mysql_connect($database_server, $database_user, $database_password);
                      if (!$link) {
                          die('Could not connect: ' . mysql_error());
                      }
                      if (!mysql_select_db($dbase)) {
                          die('Could not select database: ' . mysql_error());
                      }
                      //get the mySQL time
                      $result = mysql_query("SELECT NOW();");
                      if (!$result) {
                          die('Could not query:' . mysql_error());
                      }
                      $arr['time'] = mysql_fetch_array($result);
                        
                      //returns the system timezone.
                      $result = mysql_query("SELECT @@system_time_zone;");
                      if (!$result) {
                          die('Could not query:' . mysql_error());
                      }
                      $arr['systimezone'] = mysql_fetch_array($result);
                        
                      //returns the session timezone if it differs from the system timezone.
                      $result = mysql_query("SELECT IF(@@session.time_zone = 'SYSTEM', @@system_time_zone, @@session.time_zone);");
                      if (!$result) {
                          die('Could not query:' . mysql_error());
                      }
                      $arr['sestimezone'] = mysql_fetch_array($result);
                      mysql_close($link);
                        
                      $times = 'php time is: '.$arr['php'].'
                      ';
                      $times .= 'mySQL time is: '.$arr['time'][0].'
                      ';
                      $times .= 'mySQL system timezone is: '.$arr['systimezone'][0].'
                      ';
                      $times .= 'mySQL session timezone is: '.$arr['sestimezone'][0].'
                      ';
                        
                      return $times;
                        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