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

    I think it would be much better to enable the FlexSearchForm to use Placeholders rather than having to reinsert the snippet:

    Just two place holders and the snippet.
    [[FlexSearchForm]]
    [+FlexSearchForm_Panel+]
    [+FlexSearchForm_Results+]


      xWisdom
      www.xwisdomhtml.com
      The fear of the Lord is the beginning of wisdom:
      MODx Co-Founder - Create and do more with less.
      • 25663 MODX Staff
      • 12,272 Posts
      That sounds really great to me. I totally agree.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 22303 MODX Staff
        • 10,725 Posts
        This is the way I prefer to do all of my snippets/layouts. I just reconstructed an extranet application with three different access groups, and built the all of the components using this technique. It’s so easy to change the layout; I love it. We have almost complete separation of UI and logic; I love it!

        I’ve even been thinking about using a TV to select snippets to include on a page from a list box with parameter strings, then simply use the appropriate placeholders in the content.
          • 33337
          • 3,975 Posts
          Quote from: xwisdom at Nov 29, 2005, 01:46 PM

          Hi Everyone,

          I think it would be much better to enable the FlexSearchForm to use Placeholders rather than having to reinsert the snippet:

          Just two place holders and the snippet.
          [[FlexSearchForm]]
          [+FlexSearchForm_Panel+]
          [+FlexSearchForm_Results+]

          kiss kiss kiss
            Zaigham R - MODX Professional | Skype | Email | Twitter

            Digging the interwebs for #MODX gems and bringing it to you. modx.link
            • 13577
            • 302 Posts
            Quote from: xwisdom at Nov 29, 2005, 01:46 PM
            ...
            Just two place holders and the snippet.
            [[FlexSearchForm]]
            [+FlexSearchForm_Panel+]
            [+FlexSearchForm_Results+]
            ...

            That sounds cool... now if I only knew what the heck a placeholder was... laugh I think I’ll be spending a good portion of the day reading documentation before I start asking noob questions!
              Standard Disclaimer
              I could be totally wrong.
              • 25663 MODX Staff
              • 12,272 Posts
              Placeholders are a great way to seperate content from code. Give a designer a few placeholders, and write snippets to set their values. A single placeholder can be set by multiple snippets, for example. Leads to a lot of very interesting possibilities. smiley
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                I’ve been playing with placeholders, and pretty much have a handle on them I believe. They are just tags like [+name+] that get replaced either in the snippet code or using MODx class functions (methods?) by a specified variable value, usually using str_replace:

                str_replace("[+date+]", $date, $template);
                


                Now you can put [+date+] anywhere you like in $template, and the code will replace it with $date.

                <div class="summaryPost">
                        <h3>[+title+]</h3>
                        <div>[+summary+]</div>
                        <p>    [+link+]</p>
                        <div style="text-align:right;">by <strong>[+author+]</strong> on [+date+]</div>
                    </div>
                
                  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
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Actually Susan, placeholder do not need to be replaced using a manual str_replace as the parser does this for you using regular expressions. Often people do this in a small chunk of content to replace specific template expressions that might be repeated on a single page with different values and thus would not apply to the page scope of actual placeholders. In these cases, the decision to use [+ +] as the replacement variable tags is up to the snippet developer.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    I know, I was just showing this way to clearly illustrate how they work. I prefer to use the $modx functions myself.
                      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