Forum

Thread tagged as: Question

Reuse repeater in multi language site

Hi,

I am using Strategy Two as described on this page.

I have part of a page that uses this region:

<?php perch_content('Fund Logos Slider - '.$lang); ?>

and uses the following template:

<perch:before>
    <section class="fund-logos">
        <div class="container">
            <div class="row">

                <div class="col-sm-12 text-center">
                    <h2><perch:content id="intro-text" type="textarea" label="Intro text" size="xs" /></h2>

                    <div class="fund-logo-slider">
</perch:before>

                        <perch:repeater id="slide" label="Slide">
                        <div class="logo-slide">
                            <div class="row">
                                <div class="col-sm-2 col-sm-offset-2 col-xs-6 col-xs-offset-0">
                                    <img src="<perch:content type="image" id="logo1" label="Logo 1" width="165" height="80" help="Images should be 165 x 80px" />" alt="" class="img-responsive center-block" />
                                </div>
                                <div class="col-sm-2 col-xs-6">
                                    <img src="<perch:content type="image" id="logo2" label="Logo 2" width="165" height="80" help="Images should be 165 x 80px" />" alt="" class="img-responsive center-block" />
                                </div>
                                <div class="col-sm-2 col-xs-6">
                                    <img src="<perch:content type="image" id="logo3" label="Logo 3" width="165" height="80" help="Images should be 165 x 80px" />" alt="" class="img-responsive center-block" />
                                </div>
                                <div class="col-sm-2 col-xs-6">
                                    <img src="<perch:content type="image" id="logo4" label="Logo 4" width="165" height="80" help="Images should be 165 x 80px" />" alt="" class="img-responsive center-block" />
                                </div>
                            </div>
                        </div>
                        </perch:repeater>

<perch:after>
                        </div>

                    <p><a href="<perch:content id="url" type="text" label="URL" size="xl" help="e.g. /path-to-page" />"><perch:content id="link-text" type="text" label="Link Text" size="xl" /></a></p>
                </div>

            </div>
        </div>
    </section>
</perch:after>

In admin, for each language I am changing the <perch:content id="intro-text" type="textarea" label="Intro text" size="xs" /> and <perch:content id="link-text" type="text" label="Link Text" size="xl" /> areas to reflect the language change.

Unfortunately, with this structure, I have to add the images to each language but actually they need to be the same.

I can't think of a way of reusing this repeater on each content area for each language based on populating in once. Can you point me in the right direction?

Thanks, Andy

Andy Knight

Andy Knight 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use perch_content_custom() to redisplay the same content with a different template - perhaps a template that only includes that one repeater.

Hi Drew,

Not sure how this would work with the current set up?

Would this mean that I would need to split up the template into 3 regions? So that i can retain the intro text and link text areas in the multi language?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not sure - I'm struggling to visualise what you're trying to do.