squeaker
squeaker

Reputation: 395

modx - Using a dynamic ID in gerResourceField

I need to use a 'start id' that is set as a TV in a specific resource.

This is the basic call i'm trying to make dynamic:

1

[[getResourceField? &id=`298` &field=`longtitle`]]

It seems that i can not nest another getResourceField to get this working:

[[getResourceField? &id=`[[!getResourceField? &id=`[[*photoGalleryId]]` &field=`albumStart` &processTV=`1`]]` &field=`longtitle`]]

I've also tried putting ID collector as a separate chunk which also fails.

Any ideas?

Upvotes: 0

Views: 196

Answers (2)

squeaker
squeaker

Reputation: 395

In case anyone else stumbles upon this it required the second snippet to be called uncached (without the !):

[[getResourceField? &id=`[[getResourceField? &id=`[[*photoGalleryId]]` &field=`albumStart` &processTV=`1`]]` &field=`longtitle`]]

Upvotes: 0

Sean Kimball
Sean Kimball

Reputation: 4494

I'm not familiar with getResourceField - but can you not just place the TV in the ID?

[[getResourceField? &id=`[[*photoGalleryId]]` &field=`longtitle`]]

it kind of looks to me like you want to do this instead?

[[getResourceField? &id=`[[*photoGalleryId]]` &field=`albumStart` &processTV=`1` &field=`longtitle`]]

If you are trying to use the photoGalleryId TV of the ~current~ resource, if you are trying to get it from a different resource you will need a snippet.

Upvotes: 1

Related Questions