1

I'm trying to import posts using the Feed Me plugin. I'd like to make a dynamic URL so that I can access the feed from a Cron job or from elsewhere in the CP. It says in the docs that I can use environment variables inside the Feed URL, but it isn't working for me. Am I using them the wrong way?

My Feed URL (not working):

http://some-url.com/{{issueNumber}}

Apart from environment variables, is there some other way to pass variables into Feed Me? The client won't have direct access to the Feed Me plugin and therefore won't be able to manually edit the URL each time.

  • Update: I've updated my code so that this is no longer necessary, but I'm leaving the question up in case someone can use it in the future. – jtenclay Jan 15 '18 at 19:51
2

There's currently no method to parse variables into the feed itself through this, or any means. Typically, we approach this as feeds being third-party, or otherwise non-editable. How would you see utilising issueNumber to work in this scenario?

You can use the concept of aliases in your URL if that helps?

Lastly, you could also make use of the (undocumented) Datatype::EVENT_AFTER_FETCH_FEED event to perform any parsing on the feed once its been fetched?

  • It turned out the way I was thinking about this didn't really make sense – I was hoping that I could use another plugin to edit the feed URL before starting it, essentially pulling data from a different URL each time. I ended up handling that bit in the other plugin by making a local copy of the changing file each time so that Feed Me could point to the local version reliably. – jtenclay May 7 '18 at 20:46
  • I think using aliases probably would have been a more straightforward way, so I'm definitely going to use that suggestion in the future – jtenclay May 7 '18 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.