=============================
Select, Mutli-Select and Tags
=============================
Select and Multi-Select are special purpose content tags. They're used for choice fields on pages, but they also can be used
to group pages with the same select values. This is useful for tagging and other complex taxonomies.
Adding a select to a page
-------------------------
To add a single select to a page use the following tag structure. This is like other page tags, where the name comes first, and then the options.::
Examples::
{% page "category" type="select" %}
{% page "tags" type="select" multiple="true" %}
Getting Data about a select
---------------------------
The `{% select %}` template tag will get data about tags in use::
{% select "tags" %}
{% for tag in tags %}
- {{ tag.record }}
{% endfor %}
For a site about electronics that might render::
- Arduino
- Power Supplies
- LCD Display
Getting Pages that match a select
---------------------------------
The `select_page` template tag is used to get pages that match a particular record. Continuing on the electronics theme, here's an example::
{% select_page "tags" "LCD Display" %}
{% for selected_page in pages %} {# don't reuse the variable `page`, it's bad form #}
- {{ selected_page.content.title }}
{% endfor %}
That might render::
- 22" IPS Display
- 7" TFT Raspberry Pi Display
- TFT versus IPS Technology
It's possible to combine `select` with `select_pages` to do complex listings.
I really like examples.::
{% select "tags" %}
{% for t in tags %}
- {{ t.record }}
{% select_pages "tags" t.record %}
{% for selected_page in pages %}
- {{ selected_page.content.title }}
{% endfor %}
{% endfor %}
That might render::
- Arduino
- Arduino Nano is back in Stock!
- Adafruit has new wifi Arduino-compatible board
- Power Supplies
- LCD Display
- 22" IPS Display
- 7" TFT Raspberry Pi Display
- TFT versus IPS Technology