+ Reply to Thread
Results 1 to 3 of 3

Thread: if statement for checkboxes values

  1. #1
    Senior Member
    Join Date
    Dec 2023
    Posts
    161

    if statement for checkboxes values

    On the listing_details.tpl, is there a way to do an if statement based on checkbox values?

    For example if I have
    group "option"
    field "options" which is type: checkboxes with [x] Radio [] something else [x] one other thing [] etc

    Is there a way to do an if conditional such as:
    {if $listing.option.Fields.options.value == 'radio'}<div class="radio">Radio</div>{/if}
    Last edited by Horizon; February 23, 2024 at 07:37 AM.

  2. #2
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,174
    under:
    Code:
    Only registered members can view the code.
    use this code:
    Code:
    Only registered members can view the code.

  3. #3
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Thanks! Worked a charm.

    Also found in_array useful to be able to send my specific "option" group to a specific fields_out.tpl routine:

    {if in_array(option,$group)}
    ...
    {/if}

+ Reply to Thread