K
K
khomaldi2020-11-24 13:01:02
MODX
khomaldi, 2020-11-24 13:01:02

How to pass a parameter to a snippet?

Hello. MODX R 2.7.3-pl.

There is a file for generating a product catalog in xml format. On the 27th line, I want to call the getExternalCode snippet and pass the $sync_data variable to this snippet.

How to do it?

If you write simply , then a string (json) is displayed - everything is ok. But I need to pass this variable to the snippet so that it parses the line and returns the data I need. Please tell me the solution, I'm not well versed in MODX. Already went to 3-4 pages of search results, it still didn’t work. Thanks :) externalCode="$sync_data"


Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
khomaldi, 2020-11-24
@khomaldi

SOLUTION
I don't know why, but it works for me personally only using {}. That is, instead &sync_data=`$sync_data`of writing&sync_data=`{$sync_data}`

externalCode=""

Many thanks to Danny Arty and Anton Tarasov for their help!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question