Hi, I need to create a TV that can be dynamically populated by a group of resources, not sure on the best approach. Let me explain what needs to happen:
I'm developing a site that will have several dozen client testimonials, I want to create a group in the resource tree for these testimonials so that the client can add a new resource for each new testimonial. fine - easy enough. Where it gets tricky is that on each page I want to include a testimonial that the client can pick. i.e. they create a new page/resource and in the template variables section there is a pick list/drop down of all the available testimonials.
So I'm not sure what the best way to handle this is, ideally, create a snippet or chunk or something that uses getResources to retrieve the list of child resources for the testimonials tree & somehow populates that TV on the fly... ?
- any suggestions?
-thanks
-sean
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
Does the client need to see the content of the resources, or would the pagetitle do?
One way would be to use @EVAL in the TV's Input Option Values field to run a custom snippet (with runSnippet() ) that would grab what you need from those resources and return it. The client could select one from a drop-down list or radio options.
no - the client only needs to see the resource title... I thought there was a way to reference output from a chunk in a TV?
-sean
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
-
☆ A M B ☆
- 3,141 Posts
Have a look at the resourcelist TV input type.
When in 2.1 it'll give you a bunch of options to fine tune it, in <2.1 I think you need to specify the ID of the parent resource in the input options field.
Mark;
I shake my head every single time I see how easy stuff like this is in modx.
That works perfectly, all I had to do was setup the resourcelist TV point it at my parent resource and then in my template:
[[!If? &subject=`[[*ShowTestimonial]]` &operator=`!empty` &then=`[[$TestimonialCallout]]` ]]
& the chunk
<div id="testimonial" class="callout">
[[!getResourceField? &id=`[[*ShowTestimonial]]` &field=`content` ]]
</div>
Thanks Mark...
-sean
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
-
☆ A M B ☆
- 3,141 Posts
Hehe, MODX does that
There's another related tutorial here that makes use of a snippet and @EVAL, though it is aimed at showing multiple resources (in your case, testimonials):
http://rtfm.modx.com/display/revolution20/Creating+a+multi-select+box+for+related+pages+in+your+template
Thanks Mark... heh-heh... "client proof"

I love it...
-sean
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
I totally forgot about the resource list TV type (although it's in my book).