We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3767
    • 40 Posts
    Regarding when you are supposed to add a parameter to a call, or when you are supposed to edit the snippet code inside the manager? Sometimes calls dont work, and other times the code inside is a little complex for me to know what to change.

    For example, I guess look at the ditto code

    $truncAt = isset($truncAt) ? $truncAt : $_lang['default_splitter'];
        // where to split the text
    


    now I know that these parameters could be used in the call, but $_lang[’default_splitter’] seems like you either change the text in there, or make a TV or something..Im not so sure. Thats not real important, as much as if theres a general rule for when to do what, or do I just have to learn on a per snippet basis?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Snippets are written by different MODx users, usually to solve a need they have for a specific site, and they sometimes kindly make them available to the project. So while there is a sort of informal "best practices", there is no way to enforce any kind of strict rules. These are really gifts, by volunteers, so the concept of not looking a gift horse in the mouth might be applied.

      As far as the Ditto feature you mention, that is indeed an option. The Ditto documentation has a list of optional arguments.
        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
        • 3767
        • 40 Posts
        Quote from: sottwell at Feb 02, 2007, 11:30 AM

        Snippets are written by different MODx users, usually to solve a need they have for a specific site, and they sometimes kindly make them available to the project. So while there is a sort of informal "best practices", there is no way to enforce any kind of strict rules. These are really gifts, by volunteers, so the concept of not looking a gift horse in the mouth might be applied.

        As far as the Ditto feature you mention, that is indeed an option. The Ditto documentation has a list of optional arguments.

        Ok, I hope I didnt come off as being rude in my last post, because your post certainly does. I have made it clear that I dont know exactly what I am doing and that I may ask a bunch of dumb questions. Lets use a good analogy here for me "not looking a gift horse in the mouth". Say for christmas I get an alternator for my car from my uncle, a gift if you will. I have changed the oil and wipers and such in my car, but never anything this big. So I ask my uncle "Hey, is every belt for alternators the same, or is there a specific rule?" and he looks at me and says "Dont look a gift horse in the mouth" and points me to the instructions that come with the alternator, which shows the belt on the alternator, but has no trace of answering the question I asked. Thats what this feels like, because looking in the Ditto documentation I see

        &truncAt Where to split the text $_lang[’default_splitter’]

        Which tells me nothing really. sad


        Now, a simple "no, its contextual to the snippet" would be fine, because from what I have gathered, the stuff prefixed with & can be used in the call and the stuff with $ is edited in the code, but some seem to be editable in the code if prefixed with & and I was just trying to get a confirmations, because changing it in the code is easier than writing out a 4 line call.


        undecided
          • 25663 MODX Staff
          • 12,272 Posts
          I think you read way too much into Susan’s response. She’s probably the most helpful, non-confrontational, non-condescending and patient members we have. Perhaps she didn’t know exactly what answer you were looking for ...
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 33337
            • 3,975 Posts
            The default value for &truncAt is <!-- splitter --> , You can use it in article to pull some part of the content into Ditto listing instead of writing a separate summary of the post. e.g.

            some article stuff goes here. <!-- splitter --> rest of the article goes here.

            now when you put [+summary+] in your Ditto template, it will show only the part before <!-- splitter --> if summary (introtext) field is empty.

            for more info on parameters: http://modxcms.com/ditto_parameters.html

            Hope this makes sense.

            regards.
              Zaigham R - MODX Professional | Skype | Email | Twitter

              Digging the interwebs for #MODX gems and bringing it to you. modx.link
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Indeed, I was philosophizing on the concept of a "rule of thumb" for snippets, and speaking in terms of the MODx team not trying to make hard-and-fast rules about how a snippet should be written.
                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
                • 3767
                • 40 Posts
                I apologize then, I understand that they were written separately, and I assumed that it was on a per snippet basis, but I didnt want to just assume that if I could speed up the process. It just sounded like I was being reprimanded for thinking maybe there was a standard way people could go about this. grin