We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42476
    • 5 Posts
    Hello - we are new to MODX and are used to the process of developing locally and moving updates live, once tested. What we have not found is any in depth information about what a typical update cycle would look like (I'm a guy, so maybe it is out there, but have not looked too in-depth). Lets say a client wants a new page added, or we are re-doing a header. We wouldn't want to make those changes in the production environment without testing them. What is the process for making minor to mid-level updates with MODX?

    • Do we develop locally and then have to backup the database and a subset of files, and deploy those to production?
    • Do we need to do the work twice? Once locally and then repeat everything on production?
    • Is there a way to promote it from our local machines that we are just missing?


    I see a lot out there about how to move your site from testing to production, but that looks to me like it would be when migrating, or switching hosting providers, but not to just make simple updates.

    Thanks so much

    Mike
    • Quite honestly, the easiest way to do what your example showed is to use a duplicate testing template, put your new code into some chunks, call them in the duplicate template. Hide the resource from menus and stick it in a hidden "tools" type container resource. That way you can develop your heart out with such changes and never touch either the site or users till you want to touch them. Then in the existing template, just call the new chunk(s).
        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
        • 42476
        • 5 Posts
        Thanks Frogabog - so it sounds like with MODX, you're always working in production. The method you recommended (from what I gathered) is to have a dupe template (sounds like a copy of the site) that I'll be making the changes, and the exposing them to the live site. Would you agree with that? Or am I off track a bit?

        To take my example into a bit more detail, lets say I want to update the header for an existing site, would the duplicate template method be able to handle that?

        As is quite obvious, I just need to do some more learning, but with a few requested changes looming, want to make sure I'm approaching it the best way possible.

        Thanks again

        Mike
        • You can do what you want with MODX. It's just easier to work on the production site because you CAN hide what you're doing and make it very simple to implement as needed with the chunks you develop.

          If you want to work locally, you can do a mySQL dump into a local site, work it and then upload to the live site. It's just a little more work and you'll need to edit the config files any time you move the db. Also, if you develop on the production site there's less chance of some kind of conflict, say... php versioning.

          When I say template, I don't mean the entire site. I just mean the template that you're using. The easiest way to template in MODX (IMO) is to use chunks. So say you want to change the head, your template would contain something like this:

          [[$templateHeader]]
          [[$siteBasicPage]]
          [[$templateFooter]]


          Where each chunk can be a static resource html file (for ease of editing).

          In the template header, stick all the stuff prior to the body markup. In the site basic page stick your innards, and include the [[*content]] tag where you want it to be inside the markup. In the template footer, plunk your footer stuffs in.

          When you want to develop this template, create a new duplicate. Duplicate the chunks (let's prefix them with dev. i.e. [[$devTemplateHeader]], etc.) and change the template chunk calls to reflect new names. Now you have a completely independent version of your current template. Create a new dev resource, associate the new template, and hide the resource from menus. Develop away. When you're done, either change the existing template calls to reflect new chunks, or paste your new chunk innards into the old head, page, and footer chunks. Done!

          This is just one way to do it. The beauty of MODX is all the different ways to do the same thing.

          :~}
            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
            • 42476
            • 5 Posts
            Thanks so much Frogabog. This is excellent and I think your answers give me exactly what I need. Thanks again.
            • Oh Good! Cuz, you know I used proper techy words like innards and stuffs. Have fun! :~}
                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
              • There are probably five different working styles for every three MODx users laugh

                I prefer to have my template contain as much of the basic HTML "skeleton" as possible so I can see at a glance where everything is, and only use chunks where it's obvious that you'll want to share things across multiple templates. I don't like looking at a template and just seeing a bunch of chunks that I now have to go look at to see bits and pieces of my page structure.

                Usually I'll only put the masthead and main menu and the footer sections into chunks. I've been known to put the footer into a separate resource, and use getResourceField for it. This is because the footer often contains contact information (address, phone number, etc) that the client wants to change from time to time, and this makes it easier to use something like QuickBar to simplify that for him.

                Each sidebar block will be a chunk, but the sidebar structure will be part of the template; usually I use MIGx or Asides to handle the sidebar blocks. Things that aren't going to change, like most of the HTML head, stays in the template. Javascript includes and specific CSS files are loaded dynamically as needed with snippets or plugins.
                  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
                • To answer your direct question, however, I usually make a category "Susan Testing", and a container resource of the same name (unpublished). I use that category to keep all of my dev and testing stuff in. If I'm going to do anything exotic, then I'll do it on a local (or Cloud) dev first. But MODx is pretty stable; it's not easy to break it - unless you're playing with stuff that can meddle with the database or do system commands. Testing a snippet to run something like
                  <?php
                  $sql = 'TRUNCATE TABLE modx_site_content';
                  ...
                  

                  or
                  <?php
                  $output = `rm -Rf`; // run system command
                  return $output;

                  on a production server wouldn't be a very good idea. So it does take exercising a certain amount of judgment and common sense.
                    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
                  • Quote from: sottwell at Jan 08, 2013, 12:00 AM
                    There are probably five different working styles for every three MODx users laugh

                    I prefer to have my template contain as much of the basic HTML "skeleton" as possible so I can see at a glance where everything is, and only use chunks where it's obvious that you'll want to share things across multiple templates. I don't like looking at a template and just seeing a bunch of chunks that I now have to go look at to see bits and pieces of my page structure.

                    Agreed. The only difference for me is, I know what the template contains, three chunks. So I never look at it. I used to use the includeFile snippet, but with static resources now I can work primarily in a text editor as I prefer to just by setting the chunk static resource to my middle chunk file.

                    Same thing, just a different way of going about it. There are likely more than five working styles per every three, and they all work :~}

                    I always have the text editor open, sftp directly to the site with ctrl+s. As a tab junkie, I've got my file tabs there, and can navigate back and forth between files easily, fix indentations, etc. I don't hate coding in the MODX Manager, but don't enjoy it. I prefer an external editor in most cases (even with the groovy text editors available now). A little bitty change here and there is fine, but it's always ugly after I've finished with it.

                    I'm also migrating towards more and more static chunks. That way I can reuse them much easier than copying and pasting between MODX managers. I find that to be a major PITA.



                      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