Loading...
Skip navigation

Sorting of data fields in list entry

If you like to push the data fields of the list entry that way, that firstly the left column is filled up until three entries are available and further entries are filled in right column, just use the following Fluid-Template

<oi:variable.set name="fieldsetFieldsHtmlLeft" value="" />
<oi:variable.set name="fieldsetFieldsHtmlRight" value="" />
<oi:variable.set name="fieldsetFieldsHtmlLeftCount" value="1" />
<f:for each="{settings.search.fieldsets}" as="fieldset" key="fieldsetKey">
    <f:if condition="{fieldsetKey} == 'general'">
        <f:for each="{fieldset.fields}" as="field" key="fieldKey" iteration="fieldIterator">
            <f:comment><!-- Label translation --></f:comment>
            <oi:variable.set name="tempLanguageKey" value="tx_openimmo_label.immobilie_{fieldKey}" />
            <oi:variable.set name="tempLanguageValue" value="{f:translate(key: tempLanguageKey)}:" />
            <f:comment><!-- Fluid field section --></f:comment>
            <oi:variable.set name="section" value="default" />
            <f:if condition="{field.section}"><oi:variable.set name="section" value="{field.section}" /></f:if>
            <f:comment><!-- Field is filled? --></f:comment>
            <oi:variable.set name="newField"><f:format.raw><f:render partial="Immobilie/{field.partial}" section="{section}" arguments="{immobilie:immobilie, label: tempLanguageValue}" /></f:format.raw></oi:variable.set>
            <oi:variable.set name="newFieldFilled" value="{oi:iterator.explode(content: newField, glue: 'dd')}" />
            <oi:variable.set name="newFieldFilled" value="{f:count(subject: newFieldFilled)}" />
            <f:if condition="{newFieldFilled} > 1">
                <f:if condition="{fieldsetFieldsHtmlLeftCount} <= 3">
                    <f:then>
                        <oi:variable.set name="fieldsetFieldsHtmlLeft"><f:format.raw>{fieldsetFieldsHtmlLeft}{newField}</f:format.raw></oi:variable.set>
                    </f:then>
                    <f:else>
                        <oi:variable.set name="fieldsetFieldsHtmlRight"><f:format.raw>{fieldsetFieldsHtmlRight}{newField}</f:format.raw></oi:variable.set>
                    </f:else>
                </f:if>
                <f:if condition="{fieldsetFieldsHtmlLeftCount} == 6"><oi:variable.set name="fieldsetFieldsHtmlLeftCount" value="7" /></f:if>
                <f:if condition="{fieldsetFieldsHtmlLeftCount} == 5"><oi:variable.set name="fieldsetFieldsHtmlLeftCount" value="6" /></f:if>
                <f:if condition="{fieldsetFieldsHtmlLeftCount} == 4"><oi:variable.set name="fieldsetFieldsHtmlLeftCount" value="5" /></f:if>
                <f:if condition="{fieldsetFieldsHtmlLeftCount} == 3"><oi:variable.set name="fieldsetFieldsHtmlLeftCount" value="4" /></f:if>
                <f:if condition="{fieldsetFieldsHtmlLeftCount} == 2"><oi:variable.set name="fieldsetFieldsHtmlLeftCount" value="3" /></f:if>
                <f:if condition="{fieldsetFieldsHtmlLeftCount} == 1"><oi:variable.set name="fieldsetFieldsHtmlLeftCount" value="2" /></f:if>
            </f:if>
        </f:for>
    </f:if>
</f:for>

<div class="col-xs-12 col-sm-6 col-md-6">
    <dl class="dl-horizontal"><f:format.raw>{fieldsetFieldsHtmlLeft}</f:format.raw></dl>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
    <dl class="dl-horizontal"><f:format.raw>{fieldsetFieldsHtmlRight}</f:format.raw></dl>
</div>

Contact request

You can contact us at any time

Stop! Playing in the meantime?

Break the highscore

Press Start
Contact request
Screenreader label
Security question
59T_________D1C______
__A____J____K_____7J1
PW2___EKH___RGA______
__R____B______R___PBH
GHZ_________YDK______