We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18337
    • 19 Posts
    I took on a Wordpress project for a site that had been hacked. After some time of trying to follow botched code with no documentation with major functionality removed by the hackers, I asked my pal to locate the last known backup of the site. To my dismay, he produced a MODx backup.

    I installed that version of the site and I do like the software but I’m having a little trouble trying to relate chunks and snippets to the documents so we can test the payment gateway. In Wordpress, I use the PHP script with embedded HTML so changes are easier to read in one swoop.

    There are 2 documents in the system that are related to purchase. There is a "chunk" that is not being used (PayPal processing) and a snippet that is being called, somehow and is being called by what looks like a Wordpress "shortcode":
    [!upgrade_membership!]

    I think I need to modify that but I can’t see how everything is tied together in this system. Is there any GOOD documentation that can help me ferret through this maze of code? Ideally, I would be able to pull up the code using my local development environment. Yes, I’m a noob but any guidance from the MODx crowd would be appreciated.
      • 3749
      • 24,544 Posts
      See the site in my sig for an overview of how MODx works.


      [!upgrade_membership!] is, indeed, a snippet tag.

      {{chunk_name}} is a chunk tag

      In the first case, the tag will be replaced by the return value (and/or echo/print output) of the snippet.
      In the second the tag will be replaced by the contents of the chunk.

      Snippet and chunk code is kept in the DB so it’s hard to get at with your editor although some people use the Firefox addon "It’s All Text" to edit it so they get syntax highlighting.

      The site is probably pre MODx 1.0, so you would find all the chunks and snippets (and templates) via the main menu Resources | Manage Resources (in MODx 1.0, it would be Elements | Manage Elements).

      Welcome to MODx. smiley
        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
        • 18337
        • 19 Posts
        Thanks for the link, Bob. I looked it over and see that there are other links to topics of interest. At least, I now understand the difference and use for snippets versus chunks.

        I did make some headway last night on figuring out how to modify the previous payment gateway code to try out the new one. As I do with all things, I kept the "working version" of the chunk and modified a copy of it for my purposes.

        I take it there is no way to pull up the assembled page in one editor, unless I create it through a browser and view the source through an editor.

        Learning this new system is kind of exciting for me. MODx looks like it is a heck of a lot more robust and stable than either Drupal or Joomla and the community is very active. Maybe I’ve had my head in the sand, or something, but I had never heard of MODx before my client sent me the backup files. Needless to say, I’m intrigued and MODx will become my "platform of choice" for some of the development work that I do.

        In defense of my "favorite" CMS, Wordpress, it is capable of doing much more than blogging so it remains a good choice for website development.
          • 3749
          • 24,544 Posts
          You can right-click on a document and select "overview" then "source" to see the finished page source (with uncached tags unprocessed) but I think it only works if the page is cached and has been visited. View Source is a more reliable view of the finished page. Neither will let you edit anything. TBH, once you get used to working in MODx, you almost never need to look at the source.

          Once you have your CSS and template the way you want them, you only need to edit the resource fields of the document and any chunks or snippets on it. You can also open the CSS file in a separate browser window via cPanel. Many of us install XAMPP and work on the site locally so you can have the CSS file open in your favorite editor. You can also have snippets "include" the source code file and work on that in your favorite editor too.

          Note also that if you turn off Rich Text Editor for a page (or for the site), you’ll see the straight HTML code for whatever is in the content field when you edit a document in the Manager.

          I agree that MODx is much more robust and has infinitely cleaner architecture than Drupal or Joomla (especially true of MODx Revolution, which is OOP from the ground up).

          I’ve used WordPress (though I’m no expert at it) and I would used it again for a site that was mostly a blog site. For anything else, I can work much faster and produce a site that is infinitely easier to maintain in MODx. YMMV. wink
            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
            • 18337
            • 19 Posts
            Wordpress has come a long way since release 2.5.1. It would be interesting to exchange viewpoints with you about ways it can be used "beyond the blog" but I know we both have our own lives to lead.

            Glad to read my high-level analysis of Joomla and Drupal feels accurate to you. I’m looking forward to learning more about MODx too.