<p>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 <code>issueNumber</code> to work in this scenario?</p>

<p>You can use the concept of aliases in your URL if that helps?</p>

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

CC BY-SA 4.0
2018-05-07T20:46:17.977Z
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
CC BY-SA 4.0
2018-05-07T20:47:21.383Z
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
CC BY-SA 4.0
2018-05-04T14:06:22.223Z
2018-05-04T14:06:22.223Z
crawf
<p>Feed Me supports this but the setting isn't turned on by default.</p>
<ol>
<li>Create an feed-me.php file under your /config directory</li>
<li>Turn on the parseTwig option using:</li>
</ol>
<pre><code>&lt;?php

return [
    '*' =&gt; [
        'parseTwig' =&gt; true
    ]
];
</code></pre>
<ol start="3">
<li>You can now use twig variables in the default value field eg. if issueNumber is a field and the field is being populated by your feed you can set the default to <code>http://some-url.com/{issueNumber}</code></li>
</ol>

CC BY-SA 4.0
2022-08-31T15:37:20.810Z
2022-08-31T15:37:20.810Z
Mike Niland
<p>Depending on what sort of dynamic data you need in your Feed URL (I needed the current date), you could also do this via the <code>feed-me.php</code> config file.</p>
<pre><code>'feedOptions' =&gt; [
    '3' =&gt; [
        'feedUrl' =&gt; $someDynamicFeedUrl,
    ]
],
</code></pre>

CC BY-SA 4.0
2023-12-19T21:53:57.330Z
2023-12-19T21:53:57.330Z
Alex Kendrick
<p>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?</p>

<p>My Feed URL (not working):</p>

<p><code>http://some-url.com/{{issueNumber}}</code></p>

<p>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.</p>

CC BY-SA 3.0
2018-01-15T19:51:02.053Z
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
<plugin-development><plugin-feedme><environmentvariables>
Using a dynamic url with Feed Me
# Using a dynamic url with Feed Me

(Asked by: username_0 on 2018-01-15)

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.

**Tags:** plugin-development, plugin-feedme, environmentvariables

> **Comments:**
> **username_0**: 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.  

---

## 3 answers

### Answer by username_1 on 2018-05-04. Score: 3 | Accepted answer

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?

> **Comments:**
> **username_0**: 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.  
> **username_0**: I think using aliases probably would have been a more straightforward way, so I'm definitely going to use that suggestion in the future  

---

### Answer by username_2 on 2022-08-31. Score: 1

Feed Me supports this but the setting isn't turned on by default.

Create an feed-me.php file under your /config directory
Turn on the parseTwig option using:

 [
        'parseTwig' => true
    ]
];


You can now use twig variables in the default value field eg. if issueNumber is a field and the field is being populated by your feed you can set the default to http://some-url.com/{issueNumber}


---

### Answer by username_3 on 2023-12-19. Score: 0

Depending on what sort of dynamic data you need in your Feed URL (I needed the current date), you could also do this via the feed-me.php config file.
'feedOptions' => [
    '3' => [
        'feedUrl' => $someDynamicFeedUrl,
    ]
],


---

