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+]
-
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
-
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.
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...

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