Hey, I am quite new to MODx and I’ve stumbled upon retrieving allowed values of a TV for a filter (I have defined a list of cities in TV and I would like to retrieve it, without the need for duplicate the list and mantain it in two places). How to achieve it?
Regards.
-
☆ A M B ☆
- 24,524 Posts
Hi, not sure exactly what you are trying to achieve here. But as I learned only this morning you could create a system setting with a comma separated list of cities, then pull it into your TV, a snippet, or directly into your template if you wish. You’d only have to maintain the one list and that would be my recommendation, but it might not be ideal if you don’t want the end user to access the site settings.
Otherwise you could use an @select binding to grab your existing TV’s settings direct from the database. Kinda depends on what you need to achieve...
-
☆ A M B ☆
- 24,524 Posts
You’ve basically got the right idea; I’m sure though that Revo has an API function for returning the default value of a given TV.