Skip to content

Instantly share code, notes, and snippets.

@Mozu-CS
Last active February 25, 2016 23:57
Show Gist options
  • Save Mozu-CS/7b510b45b612558178ed to your computer and use it in GitHub Desktop.
Save Mozu-CS/7b510b45b612558178ed to your computer and use it in GitHub Desktop.
{% with pageContext.now|date('Y') as currentYear %}
{% with themeSettings.ccYears|default('0,1,2,3')|split(',') as ccYears %}
{% partial_cache currentYear, ccYears %}
<label for="cc-year-dynamic">CC Year: </label>
<select name="cc-year-dynamic" id="cc-year-dynamic" required>
<option>{{ themeSetting.blankOptionText|default('') }}</option>
{% for year in ccYears %}
<option value="{{ currentYear|add(year) }}"{% if model.expireYear == currentYear|add(year) %} selected="selected"{% endif %}>{{ currentYear|add(year) }}</option>
{% endfor %}
</select>
{% endpartial_cache %}
{% endwith %}
{% endwith %}
<select name="cc-static" id="cc-static">
<option>---</option>
<option {% if model.expireYear == "2014" %}selected="selected"{% endif %} value="2014">2014</option>
<option {% if model.expireYear == "2015" %}selected="selected"{% endif %} value="2015">2015</option>
<option {% if model.expireYear == "2016" %}selected="selected"{% endif %} value="2016">2016</option>
<option {% if model.expireYear == "2017" %}selected="selected"{% endif %} value="2017">2017</option>
<option {% if model.expireYear == "2018" %}selected="selected"{% endif %} value="2018">2018</option>
<option {% if model.expireYear == "2019" %}selected="selected"{% endif %} value="2019">2019</option>
<option {% if model.expireYear == "2020" %}selected="selected"{% endif %} value="2020">2020</option>
<option {% if model.expireYear == "2021" %}selected="selected"{% endif %} value="2021">2021</option>
<option {% if model.expireYear == "2022" %}selected="selected"{% endif %} value="2022">2022</option>
<option {% if model.expireYear == "2023" %}selected="selected"{% endif %} value="2023">2023</option>
<option {% if model.expireYear == "2024" %}selected="selected"{% endif %} value="2024">2024</option>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment