I have a new use case.
I have a csv file cronly generated by another database server. The file is available with a URL https://one-another-site.com/data.csv
I need to build a simple html table with these CSV datas.
I think the best way is to use a template chunk with placeholder, with something like that :
But I don’t know how to make a snippet for doing this kind of stuff.
After research, I have found an old MODX addon but it can read CSV from an external file, just get some CSV fields as argument.
Do you know how to adapt this addon or if there exist another one to doing this ?
You can use the modX.getChunk function to parse a chunk and replace the placeholders in the chunk with the supplied values.
Also, you may want to use the get() and set() methods of the MODX cache manager to cache the result for some time, so that you don’t have to make the additional request to the second server for every request on your server.
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.