What is the best way to promote pages to the Homepage i.e. showing selected resources through Getresources? My idea is to have a check box (tv) available on the resources, and when it is checked, the page is shown on the Homepage, along with other filled in tv’s like highlighted image, intro text, etc.
Right now I have this on my Homepage:
[[!getResources?
&parents=`-1`
&where=`{"homepagepromotie":'Ja'}`
&tpl=`aggregate-tpl`
&depth=`0`
&showHidden=`1`
&limit=`24`
&includeContent=`1`
&sortby=`menuindex`
&sortdir=`ASC`
&includeTVs=`1`
&processTVs=`1`
&tvPrefix=``
]]
And a tv called ‘homepagepromotie’ with Radio option: Ja
But it’s not showing anything.
i suspect it has to do with &parents and &depth
bobray
March 4, 2020, 3:40pm
3
It’s because the TV values are not in the same table with the resource fields, so that TV value will never be seen in a regular search for resources.
What you need is the &tvFilters property . You’ll probably also have to change the &parents
property.
@bobray So it would be:
&tvFilters=`homepagepromotie==Ja`
? (which still does not render any results.)
What about the &parents. I thought ‘-1’ is fine in this case?
bobray
March 5, 2020, 3:49pm
5
&parents=`-1`
means ignore the parents. It assumes that you will be using either &where
or &resources
to select the targets.
Try this:
&parents=`0`
bobray
March 5, 2020, 10:53pm
7
Also, I think this should be:
&tvFilters=`homepagepromotie==1`
The Yes/No TVs are stored as 1/0.
Yes, that’s what I thought, but it’s not working with ‘1’. It works with the value of the checkbox (‘Ja’).
Got it working though; it’s the &parents=0
that did the trick.
bobray
March 6, 2020, 4:54pm
9
Is homepagepromotie a text or list TV? That would explain it.
Anyway, I’m glad you got it sorted.
bobray
March 7, 2020, 4:17pm
11
Yes, but what kind of TV?
When you edit the TV in the Elements tree, what do you see on the Input Options tab in the Input Type field?
Also, what is the Output Type on the Output Options tab?
A checkbox.
Input option value: Ja
Default value: Nee (which does not do anything of course, but made this for future features)
Output type: Default
bobray
March 10, 2020, 5:04am
13
OK, that explains it, since you set the checkbox value to ‘Ja’. If it were a Yes/No TV, it would store as 0 or 1.
If it were in english (Yes/No) then it would work with 0 or 1?
bobray
March 11, 2020, 4:49am
15
My bad, I should have checked. There is no Yes/No option for TVs. I was thinking of System Settings. Your checkbox is probably the right choice. Sorry for the confusion.