ExpressionEngine Docs

Getting Started

The Fundamentals

Advanced Usage

Best Practices

Community

Toggle Fieldtype

Toggle is a fieldtype for storing yes/no or on/off data.

toggle field

Template Tag

This field is primarily useful with conditionals:

{if toggle_field}
 Yes
{if:else}
 No
{/if}

When used as a single variable, e.g. {toggle_field}, it will output a 1 for the "on" position and 0 for the "off" position. Handy if you are exporting channel data for later import or external use. Or writing templates for robot overlords. Or for switching between two images:

<img src="/images/robot_{toggle_field}.png"> <!-- robot_0.png or robot_1.png -->

ExpressionEngine 7 Docs
©2002–2024 Packet Tide,LLC.
Edit this page

AltStyle によって変換されたページ (->オリジナル) /