Hi, I searched for similar topics but couldn’t find any. Please ignore the notes about the JavaScript/RSS - I’ll create a separate topic about this.
As you see, some podcatchers have problems showing the contributors list in an excepted way. Is there anything we can do about this (please click the image, you’ll see 4 different podcatcher)?
In the webbrowser and RSSRadio the JavaScript works perfectly fine so I was surprised that most Apps don’t - even though I understand that might be for security reasons.
I need to iterate over an custom Array (with some names and numbers) and dependent on the current Episode-Number show the people who supported this. As far as I know I can’t do this with Podlove-Template, can’t I?
This is my code:
<p>
<b>Patreon-Unterstützer dieser Episode:</b><br><br>
<script type="text/javascript">
var supporter = [
["Bootsmann Games", 1, 99, "http://www.patreon.com/bootsmanngames"],
["Kevin Gregory Agwaze", 1, 99, "http://www.kevin-agwaze.com"],
["Christian Putzke", 1, 6, "http://www.christian-putzke.de"],
];
//get episode title and extract the episode number
var episodeTitle = "{{ episode.title }}"; //double quote IMPORTANT because ep06 has the word >Let's< in the title where the ' breaks the script when you don't use double quotes here
episodeTitle = episodeTitle.split(" ")[0];
currentEpisodeNumber = parseInt(episodeTitle);
//compare all supporter with current Episode number
for (index = 0; index < supporter.length; ++index) {
//extract data
name = supporter[index][0]
subStart = supporter[index][1]
subEnd = supporter[index][2]
supporterURL = supporter[index][3]
//check if subscriptions is still valid
if ((currentEpisodeNumber >= subStart) && (currentEpisodeNumber <= subEnd))
{
if (supporterURL != "") { document.write('<a href="' + supporterURL + '" target="_blank">'); }
document.write(name);
if (supporterURL != "") { document.write('</a>'); }
//add a "-"
document.write(' - ');
}
}
document.write(' Vielleicht auch Du? <a href="https://www.patreon.com/gamedevpodcast" target="_blank">Unterstütz uns hier.</a>');
</script>
You were right, I did it in Twig. It’s a little weird. I don’t have empty lines between the code-lines and also removed tabs and spaces before/after code-lines but still the generated HTML looks like this (at least one empty line between every iteration of an array-element):
{% for supporter in supporters %}
{% set name = supporter[0] %}
{% set subStart = supporter[1] %}
{% set subEnd = supporter[2] %}
{% set supporterURL = supporter[3] %}
{% if episodeNumber >= subStart and episodeNumber <= subEnd %}
{% if supporterURL != “” %}{% endif %}{{ name }}{% if supporterURL != “” %}{% endif %} -
{% endif %}
{% endfor %}
Vielleicht auch Du? Unterstütz uns hier.