Page 1 of 1

LISE : Get list of items in dropdown list field definition?

Posted: Sun Jun 19, 2016 4:24 am
by Squire4Hire
Is it possible, using Smarty, to get the list of items in a particular dropdown list Field Definition in LISE?

Re: LISE : Get list of items in dropdown list field definiti

Posted: Sun Jun 19, 2016 6:25 am
by Jeff
I don't understand what you are trying to do and what you need.

Maybe it would help to take a step back and describe the general problem you are having and the bigger picture of what you are trying to do?

Re: LISE : Get list of items in dropdown list field definiti

Posted: Sun Jun 19, 2016 7:45 am
by Squire4Hire
I'm using LISE to manage a list of properties for a realestate company.

The website I'm building is intended to display a grid of these properties which can be filtered using several Isotope Grid elements. Each of those filter parameters are selected in a dropdown list.

The client would choose options from dropdown lists such as City, Property Type, or Location. A list might look like:

- Industrial
- Commercial
- Residential

My Isotope Grid sets up the filters using those values by adding and removing classes to the elements in the grid. Something like 'pf-Industrial' would show all Industrial type properties.

So my question boils down to, Can I make this filtering system dynamic? Can I pull the list of property types from the dropdown list through Smarty so that I can run a loop and assign a 'pf-' to the list items? I'd like to make it so if a new property type is added to the dropdown list, a new filter is added to the template automatically.

Does that make sense?

Re: LISE : Get list of items in dropdown list field definiti

Posted: Sun Jun 19, 2016 8:16 am
by Jeff
This is just a example you need to verify variable names and the proper way to access the values.

In the {foreach} loop in the LISEInstance Summary template you can add the following line:

Code: Select all

{$filter_properties[$item->fields->propertyType->value] = "pf-{$item->fields->propertyType->value}"}
Then you can use the $filter_properties in a {foreach} loop to create the dropdown. Add "scope=global" param to the above smarty call if you want the $filter_properties variable to be use in a parent template.

The {foreach} loop for creating the dropdown will look something like:

Code: Select all

{foreach $filter_properties as $keyvar=>$itemvar}
<option value='{$itemvar}'>{$keyvar}</option>
{/foreach}
We don't have much smarty documentation on our sites because Smarty has their own sites for documentation.