-
- 6 Posts
I was having trouble getting Ditto to do what I wanted and posted a question in the General forum, but it didn’t go anywhere. So I figured I’d try getResources, but no luck. All I’m trying to do is display the value of a tv from several pages. Here’s how I tried and figure it out.
Created...
test-page
test-template
test-tv (input type: Text, iov: blank, default: blank, output: default)
test-chunk
I assigned test-tv to test-template, assigned test-template to test-page and entered blahblahblah for the tv value on test-page
If I do a sanity check and put [[*test-tv]] on test-page is displays blahblahblah, so I know that much works
Now to test getResource I made test-chunk and simply put...
<p>[[+pagetitle]]</p>
<p>[[+test-tv]]</p>
Then put this on a separate page
[[!getResources? &parents=`4` &includeTVs=`1` &tpl=`test-chunk`]]
It works for the pagetitle but not test-tv.
<p>Test Title</p>
<p> </p>
However I noticed if I break &tpl in the call (&tpl=`xtest-chunk`) it spits out the whole array.
And the tv is listed in there.
[tv.test-tv] => blahblahblah
Any ideas what I am missing? Or what else I can try?
Thanks!
Apache 2.2.1
MySQL 5.1.30
PHP 5.2.9
MODx 2.0.0-beta-5
getresources 1.0.0
-
- 6 Posts
Oh for #@#! sake it’s right there in the array. Deduct 10 geek points...
Thanks man! Been trying to figure that out for two days.
-
- 24,544 Posts
I filed a suggestion on Jira to have getResources default to an empty prefix. You’re adding weight to my case.
BTW, the initial version of getResources ignored &tvPrefix=`’’`. Imagine how long *I* spent.
-
- 76 Posts
I vote for leaving the tvPrefix empty.
BTW: Why do i have to use placeholders [[+ for my template variables instead of [[* in my chunk, when i use this snippet?
Doesn´t make sense to me.
If it works the same as it does for Evo in this regard, it is because Ditto is applying the chunk to each document as it loops through the list and processes them. If you use [[*...]] that is referring to the variable for the current document; that is, the document MODx is processing, the one with the Ditto call on it. The chunks, on the other had, are being processed by Ditto. If you use [[*...]] it still tells MODx to get the value for the current document (the one with the Ditto call on it) while the placeholder [[+...]] tells Ditto to use the value for the document it is processing at that point in the loop.
So [[*...]] is for MODx, and is for the actual current document MODx is processing, and [[+...]] is for Ditto (or Wayfinder or whatever snippet is being used) to use while looping through its list of documents to process.