We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27117
    • 28 Posts
    Hi

    I'm using Modx (currently 2.1.3) since one year for our corporate website and I'm very happy with it.

    I designed a few websites before but that was way back i 2004 and I'm coming more from a webdesign background so I'm not very familiar with PHP, Javascript, SQL and all that stuff. But thanks to this great community and with the help of a friend, I'm able to create what I need.

    Because this website was my first project with Modx, my element tree is a little bit chaotic. I had a very short time range to create the website so I did not pay attention about a proper naming convention. Because now I have some time and also more experience with ModX, I thought it would be a good Idea, to clean things up. But how?

    1.) How do you organize your snippets and chunks. Do you have a naming convention, do you use kind of a prefix rule? Do you organize them within folders?

    I'm very interested in your workflows. Especially for a beginner, I think it's hard to organize stuff in a proper manner from the begining.

    2.) Show where and how many times a Snippet, Chunk, TV or Template is used
    Dozens of times, I thought it would be very helpful, if I could see in an element, how many times and where it is used. Why? I give you an example: I have a few chunks that I created in a early stage of my website built process. Now they are just laying around but I'am not quite sure, if I still use them anywhere. I hope you see what I mean.

    I completely understand, that when you organize your work well - and that should be the basic principle of every project - this feature would not be necessary. But to be honest, how many times, things get unorganized as time goes on, especially if you are more a (chaotic) creative person smiley

    I'm looking forward to your thought, ideas and workflow tips.

    Thanks!

      Modx 2.1.3, PHP 5.2
      • 3749
      • 24,544 Posts
      I always capitalize all words in the names of snippets, chunks, and plugins (e.g., SnippetName).

      I generally don't use a prefix on snippet and chunk names except when I make my own version of one that comes with a package. You often need to modify Tpl chunks used by extras and I think it's a good practice to duplicate them and prefix the name with "My".

      I think there's an extra now that reports the names of snippets and chunks that are in use on the site, but I can't remember what it's called.


      ---------------------------------------------------------------------------------------------------------------
      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
        • 27117
        • 28 Posts
        Hi Bob

        Thanks, I will look around if I could find the extra that reports the use of snippets and chunks.

        Can you give some more details about how you name your Snippets and Chunks? Maybe you can make some real examples from a medium web project you realized.

        In my main job, I work as a motion designer and photographer and there I have an absolutely strict naming convention and folder structure for every project. It took me years to figure it out but now it is nearly 100% rock solid. But in the webdesign world, I can't get it for now.
          Modx 2.1.3, PHP 5.2
          • 3749
          • 24,544 Posts
          I'm afraid I don't have much in the way of great pearls of wisdom for you on this. I simply name my snippets and Plugins for what they do (EmailResource, RefreshCache, SyntaxHighlighter, LogPageNotFound, etc.). When I started in MODX, I used to prefix all of them with "My" so I could tell them from the ones I got somewhere else, but I don't do that any more.

          With chunks, I try to indicate what's in the chunk or what it's for and I always put "Tpl" somewhere in the name of a Tpl chunk. A Tpl chunk is a regular chunk that's used as a mini-template by a snippet. It has placeholder tags in it that are replaced after the snippet grabs the chunk (or during the grab) and before it's injected into the web page for display.

          When an extra comes with it's own Tpl chunks, you don't want to modify them because they may be overwritten when you upgrade the extra. I duplicate them and add "My" as a prefix.

          Similarly, with Property Sets, whenever possible, I name them for the object they're connected to with a "My" prefix (e.g., "MyGetResourcesPropertySet," "MySPFormPropertySet," etc.).


          Folder structure is mostly dictated by how you want your Menu to look, since virtually all MODX menus are created with Wayfinder and it bases the menu structure on the Resource Tree.

          I have a fairly strict rule about not going more than three levels deep with the tree (not counting the context folder - e.g., 'web). When I violate it, I'm almost always sorry.


          ---------------------------------------------------------------------------------------------------------------
          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