Answers.Body: <p>Close! You can get the selected <a href="http://buildwithcraft.com/docs/radio-buttons-fields" rel="nofollow">radio button</a> by its label (what the user sees) or the value you setup in the admin. I'm assuming you're using the value.</p>
  
  <pre><code>{% if entry.column == "two" %}
      {# show 2 column content #}
      2 columns
  {% elseif entry.column == "three" %}
      {# show 3 column content #}
      3 columns
  {%endif%}
  </code></pre>
  
  <p>You could also try a <a href="http://buildwithcraft.com/docs/templating/switch" rel="nofollow">switch</a> statement. That gives you a way to fall back to a default option, which might be useful, and a cleaner way to check for more than a couple options (say the client wants a 3 column option with some a special sidebar that doesn't really fit):</p>
  
  <pre><code>{% switch entry.column %}
  
      {% case "two" %}
  
         {# show 2 column content #}
         {% include "layouts/_2columns.html" %}
  
      {% case "three" %}
  
         {# show 3 column content #}
         {% include "layouts/_3columns.html" %}
  
      {% case "threespecialsidebar" %}
  
         {# show 3 column content #}
         {% include "layouts/_3column_sidebar.html" %}
  
     {% case "default" %}
  
        {# default to a 1 column layout #}
        {% include "layouts/_default.html" %}
  
  {% endswitch %}
  </code></pre>
  
  <p>To keep yourself sane, in the <code>switch</code> example, also consider using a <a href="http://twig.sensiolabs.org/doc/tags/include.html" rel="nofollow"><code>include</code></a> which will bring in a corresponding layout file, depending on which layout you want.  (A stray <code>div</code> for example will drive you crazy.... consider putting your markup in separate files.)</p>
  
  <p>One last thing: from a client standpoint, depending on what you're doing, an <a href="http://buildwithcraft.com/features/entry-types" rel="nofollow">entry type</a> might be a better way to handle multiple layouts or if there needs to be additional options/fields in a  certain layout. (In that case, use <code>entry.type</code> instead of <code>entry.column</code> but the rest of the syntax posted above would be exactly the same).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-06T14:31:44.940Z
Answers.Text: Thank you this worked had the feeling I was close but ended up just going try and error coding and still ended up with nothing Thank you so much!
Answers.UserDisplayName: Justin Dekkers
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-06T14:15:55.577Z
Answers.LastActivityDate: 2015-07-06T14:26:25.520Z
Answers.LastEditDate: 2015-07-06T14:26:25.520Z
Answers.UserDisplayName: RitterKnight
Body: <p>I want to let my customer decide if they want a 2 or 3 column page so I made a radio button but now I need to show different content if they select one of them but I cant get the syntax right.</p>
  
  <pre><code>{% if entry.column.contains ('two') %}
     content here for two columns
  {% endif %}
  
  {% if entry.column.contains ('three') %}
     content here for three columns
  {% endif %}
  </code></pre>
  
Tags: <templating><entries><control-panel>
Title: Displaying content defined by radio button in admin panel
ThreadText: # Displaying content defined by radio button in admin panel
  
  (Asked by: username_0 on 2015-07-06)
  
  I want to let my customer decide if they want a 2 or 3 column page so I made a radio button but now I need to show different content if they select one of them but I cant get the syntax right.
  
  ```
  {% if entry.column.contains ('two') %}
     content here for two columns
  {% endif %}
  
  {% if entry.column.contains ('three') %}
     content here for three columns
  {% endif %}
  
  ```
  
  **Tags:** templating, entries, control-panel
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-06. Score: 2 | Accepted answer
  
  Close! You can get the selected [radio button](http://buildwithcraft.com/docs/radio-buttons-fields) by its label (what the user sees) or the value you setup in the admin. I'm assuming you're using the value.
  
  ```
  {% if entry.column == "two" %}
      {# show 2 column content #}
      2 columns
  {% elseif entry.column == "three" %}
      {# show 3 column content #}
      3 columns
  {%endif%}
  
  ```
  
  You could also try a [switch](http://buildwithcraft.com/docs/templating/switch) statement. That gives you a way to fall back to a default option, which might be useful, and a cleaner way to check for more than a couple options (say the client wants a 3 column option with some a special sidebar that doesn't really fit):
  
  ```
  {% switch entry.column %}
  
      {% case "two" %}
  
         {# show 2 column content #}
         {% include "layouts/_2columns.html" %}
  
      {% case "three" %}
  
         {# show 3 column content #}
         {% include "layouts/_3columns.html" %}
  
      {% case "threespecialsidebar" %}
  
         {# show 3 column content #}
         {% include "layouts/_3column_sidebar.html" %}
  
     {% case "default" %}
  
        {# default to a 1 column layout #}
        {% include "layouts/_default.html" %}
  
  {% endswitch %}
  
  ```
  
  To keep yourself sane, in the `switch` example, also consider using a [`include`](http://twig.sensiolabs.org/doc/tags/include.html) which will bring in a corresponding layout file, depending on which layout you want. (A stray `div` for example will drive you crazy.... consider putting your markup in separate files.)
  
  One last thing: from a client standpoint, depending on what you're doing, an [entry type](http://buildwithcraft.com/features/entry-types) might be a better way to handle multiple layouts or if there needs to be additional options/fields in a certain layout. (In that case, use `entry.type` instead of `entry.column` but the rest of the syntax posted above would be exactly the same).
  
  > **Comments:**
  > **username_0**: Thank you this worked had the feeling I was close but ended up just going try and error coding and still ended up with nothing Thank you so much!  
  
  ---
  
  