All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Checkbox group "widgets" on/off

edwinvermaas 21 Nov 2012 18:59 question, complete

I want to create a sidebar and allow them to on/off widgets with a checkbox group.
So far i have the code below which works well, but it isn't this flexible with the option names.

Does anybody has a idea how to make this more flexible or just to make the code nicer?

 
{exp:low_variables:options var="lv_sidebar"}
{if lv_sidebar:data == "Programma" AND active == "y"}
{embed="widgets/program"}
{/if}

{if lv_sidebar:data == "Nieuws" AND active == "y"}
{embed="widgets/nieuws"}
{/if}

{if lv_sidebar:data == "Nieuwsbrief" AND active == "y"}
{embed="widgets/nieuwsbrief"}
{/if}

{if lv_sidebar:data == "Agenda" AND active == "y"}
{embed="widgets/agenda"}
{/if}

{if lv_sidebar:data == "Pupil van de Week" AND active == "y"}
{embed="widgets/pupil"}
{/if}
{/exp:low_variables:options}

Replies

  1. Low 22 Nov 2012 10:08

    You could try a setup with Matrix, perhaps.

  2. edwinvermaas 22 Nov 2012 12:55

    With matrix it works very well, thanks for the tip. Next obstacle is to customize it for every page, so the user can decide which widget is on a specific page.
    More tips are welcome :D

     
    {exp:low_variables:pair var="sidebar_page_test"}
    {if cell_2 == "Ja"}
    {{cell_3}}
    {/if}
    {/exp:low_variables:pair}


    Cell1 = Title
    Cell2 = Checkbox
    Cell3 = Embed code without {}

    This will look for now like this: