Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Hi,
how can I identify when in a mosaic a field comes again like e.g. a headline field to start and stop an article?

Best
Please post a screenshot of your mosaic and indicate for us at what place you'd like to stop.
Hi,
sorry that I forgett to post code!
Code: Select all
<cms:mosaic name='content' label='Inhalte' group='inhalte'>
            <cms:tile name='headline' label='Überschrift'>
                <cms:editable name='headline' label='Überschrift' type="text"/>
            </cms:tile>

            <cms:tile name='text' label='Fliesstext'>
                <cms:editable name='text' label='Fliesstext' type='richtext' toolbar='custom' custom_toolbar="<cms:embed 'ck_editor.inc' />" />
                <cms:editable name="teaser" label="Teaser" opt_values='ja' type='checkbox' />
            </cms:tile>

            <cms:tile name='speisen' label='Speisekarte'>
                <cms:repeatable name='speisen' label='Speisen'>
                    <cms:editable name='speise' label='Beschreibung Speise' type='richtext' toolbar='custom' custom_toolbar="<cms:embed 'ck_editor.inc' />" />
                    <cms:editable name='preis' label='Preis' type='text'/>
                </cms:repeatable>
                <cms:editable name="invisible" label="unsichtbar" opt_values='ja' type='checkbox'/>
            </cms:tile>

            <cms:tile name='fotos' label='Foto'>
                <cms:editable name='foto' label='Foto' type='image' show_preview='1' preview_width='150' desc='Foto zur Meldung'/>
            </cms:tile>

            <cms:tile name='fotogrid' label='Foto Raster'>
                <cms:repeatable name='grid' stacked_layout='1'>
                    <cms:editable name='foto' label='Foto/Logo' type='image' show_preview='1' preview_width='150'/>
                    <cms:editable name='url' label='Link zur Website' type='text'/>
                </cms:repeatable>
            </cms:tile>

            <cms:tile name='html' label='HTML-Code'>
                <cms:editable name='html' label='HTML' type='textarea' no_xss_check='1'/>
                " />
            </cms:tile>

        </cms:mosaic>

Normally have every part a headline-tile. and I want to use here h1 so I ahve to wrapp this with article. But I have to know when a new mosaicblock output starts. And this is on the next headline-title.

Hopeful you understand what my problem is?

Chers
Hopeful you understand what my problem is?

Yes, I think I do - you want something like the following, right?
Code: Select all
<article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!</p>
</article>

<article>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.</p>
</article>

<article>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
</article>

There could be several ways of create that output.
If you are sure the heading would always be the first item in the mosaic, the following sample code should suffice -
Code: Select all
<cms:show_mosaic 'content'>
    <cms:if k_tile_name='headline' >
        <cms:if k_first_row>
            <article>
        <cms:else />
            </article>
            <article>
        </cms:if>
       
        <h3><cms:show headline /></h3>
    </cms:if>
   
    <cms:if k_tile_name='text' >
        <div><cms:show text /></div>
    </cms:if>
   
    <cms:if k_tile_name='fotos' >
        <div><img src="<cms:show foto />" /></div>
    </cms:if>
   
    <cms:if k_last_row>
        </article>
    </cms:if>
</cms:show_mosaic>

Hope it helps. Do let me know.
Hello KK,

thank you very much, this helps to solve the article problem.

Best
You are welcome :)
6 posts Page 1 of 1