We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36782
    • 109 Posts
    Hello,
    I'm stumped - I think maybe I haven't found the correct thing to read about this...

    I have a chunk, and have added some some properties to it, in sets. Now I would like to call that chunk, using those property sets, from a snippet...

    Is this possible? If I was going to call it from a modx resource, or another chunk, it would be easy: @propset

    But, from a snippet, I'm not sure. Maybe I'm trying to do something it's not meant for? Basically i am trying to get around having 10 tpl chunks for one snippet; i wan't to be able to call a tpl with a property set instead.

    Hope that's not to back-assward a description. smiley

    -gabriel
      • 3749
      • 24,544 Posts
      From my book: http://amzn.to/Qfsl1Z


      $set = $modx->getObject('modPropertySet',
          array('name'=>'MyPropertySet'));
      $props = $set->getProperties();
      $output .= $modx->getChunk('PropChunk', $props);
      


      ;)


      ------------------------------------------------------------------------------------------
      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
        • 40447
        • 165 Posts
        Coming from designing webpages with drag and drop wysiwyg, I still find it amazing that with modx you can actually code a webpage, almost like you would code a program. WoW I have all this in front of me, imagine the possibilities - - - -.
        Brian.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Drag-and-drop wysiwyg is nice as far as it goes, but as you're beginning to realize you are strictly limited to what the developers of the application let you do. And who among us has ever built a website that didn't seem to require something off-the-wall that the stock installation didn't supply? Even the hundreds of available extras never quite satisfy.

          In this regard, I'm finding that while Evo does provide an excellent set of tools for customizing a site, Revo takes the concept to a whole new level.
            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
            • 40447
            • 165 Posts
            Even the hundreds of available extras never quite satisfy.
            I have hit the walls so many times inside the box of a drag and drop editor. Html and css formatting is bound by the compiler and the rules and files are duplicated over all the pages. But that's exactly the reason why I started the cms journey and ended up with modx. I still miss the speed and easiness though, of designing a website with drag and drop wysiwyg. But I guess that's a matter of building up your own library of reusable websnippets.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Make it a habit to document and keep a copy of everything you do; you never know when that snippet or unusual way of using a chunk's properties will come in handy later.
                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
                • 36782
                • 109 Posts
                @Bob Ray:
                Thanks, that's what I was after.
                [edit]I answered my own followup question - the 'properties' can just be added to the array of field values, and can be used the same way, with placeholders, etc. Cool smiley [/edit]

                Quote from: sottwell at Aug 14, 2012, 09:34 AM
                Make it a habit to document and keep a copy of everything you do; you never know when that snippet or unusual way of using a chunk's properties will come in handy later.
                +1 on that! I'm finally getting in the habit of copying to my own snippet library, after a few years of digging through past projects to retrieve them :lol: Call me an experiential learner...
                [ed. note: unsub777 last edited this post 14 years, 2 months ago.]