Shortcode options


#1

Hi,
I am having issues using shortcode options in templates. What is the problem here?

My template:

{% set option = {
  toepisode: '3'
}|merge(option) %}

{% for episode in podcast.episodes|slice(0, option.toepisode ) %}
  <p>{{ episode.title }}</p>
{% endfor %}

And I am calling the template with the following shortcode:

[podlove-template template="name" toepisode="5"]

But it always defaults to 3. What am I missing?


#2

Actually, my code works. Must have been some caching or typing error. :slight_smile:

But another question, maybe somebody knows a solution?
How can I access a HTTP GET parameter to support paging?


#3

I don’t think GET parameters are available in Twig templates. You probably need to use the PHP Templates for this.