Answers.Body: <p>Two things, the variable you send in is called calendarId, not id. Also, inside twig code (like the set function), you don't use twig tags, just the variables directly. Try to change the params object to:</p>
  
  <pre><code>{% set params = {
      calendarId: calendarId,
      dateRangeStart: 'today',
      dateRangeEnd: '+36 months'
  } %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-28T12:59:31.183Z
Answers.LastActivityDate: 2015-07-28T12:59:31.183Z
Answers.UserDisplayName: André Elvan
Body: <p>I am using Michael Rog's Calendar plug-in and am trying to pass the calendar ID to an include.</p>
  
  <p>Parent template:</p>
  
  <pre><code>{% include '_includes/_calendar' with {'calendarId': '1'} %}
  </code></pre>
  
  <p>_includes/_calendar:</p>
  
  <pre><code>{% set params = {
      calendarId: '{{ id }}',
      dateRangeStart: 'today',
      dateRangeEnd: '+36 months'
  } %}
  
  {% for entry in craft.calendars.eventData(params).events %}
      &lt;li&gt;
          &lt;time&gt;{{ entry.startDate  | date("D d M") }}&lt;/time&gt;
          &lt;h3&gt;{{ entry.element.title }}&lt;/h3&gt;
          {{ entry.element.eventDescription }}
      &lt;/li&gt;
  
  {% endfor %}
  </code></pre>
  
  <p>I am not getting any results for that.</p>
  
  <p>If I change the params to</p>
  
  <pre><code>{% set params = {
      calendarId: '1',
      dateRangeStart: 'today',
      dateRangeEnd: '+36 months'
  } %}
  </code></pre>
  
  <p>I get the results for the correct calendar.</p>
  
  <p>I haven't used includes with variables like this before. Where am I going wrong?</p>
  
Tags: <variable><include><calendar>
Title: How to pass Calendar ID to include
ThreadText: # How to pass Calendar ID to include
  
  (Asked by: username_0 on 2015-07-28)
  
  I am using Michael Rog's Calendar plug-in and am trying to pass the calendar ID to an include.
  
  Parent template:
  
  ```
  {% include '_includes/_calendar' with {'calendarId': '1'} %}
  
  ```
  
  \_includes/\_calendar:
  
  ```
  {% set params = {
      calendarId: '{{ id }}',
      dateRangeStart: 'today',
      dateRangeEnd: '+36 months'
  } %}
  
  {% for entry in craft.calendars.eventData(params).events %}
      <li>
          <time>{{ entry.startDate  | date("D d M") }}</time>
          <h3>{{ entry.element.title }}</h3>
          {{ entry.element.eventDescription }}
      </li>
  
  {% endfor %}
  
  ```
  
  I am not getting any results for that.
  
  If I change the params to
  
  ```
  {% set params = {
      calendarId: '1',
      dateRangeStart: 'today',
      dateRangeEnd: '+36 months'
  } %}
  
  ```
  
  I get the results for the correct calendar.
  
  I haven't used includes with variables like this before. Where am I going wrong?
  
  **Tags:** variable, include, calendar
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-28. Score: 2 | Accepted answer
  
  Two things, the variable you send in is called calendarId, not id. Also, inside twig code (like the set function), you don't use twig tags, just the variables directly. Try to change the params object to:
  
  ```
  {% set params = {
      calendarId: calendarId,
      dateRangeStart: 'today',
      dateRangeEnd: '+36 months'
  } %}
  
  ```
  
  
  ---
  
  