Jump to content

Repeater fields not Displayed on Non-Default Language Page


bytesource
 Share

Recommended Posts

Hi, 

I have been dealing with a weird issue, where repeater fields are not displayed under the following specific conditions:

  • Repeaters are displayed on all pages of the default language, but not for any other language 
  • Only repeaters on the home page are affected, repeaters on other pages are displayed just fine in all languages.
  • This problem only occurs on the production sever. Everything works find locally.

This is the page in question: www.sovonex.com/es/

And this is the English (default language) page for comparison: www.sovonex.com

The image at the top is part of a repeater and called like this:

<?php
$img = $page->slides->first()->image;

echo $img->render(array('class' => 'responsive-image')); // render() is a custom hook that deals with responsive images and lazy loading

I had to disable the output of the image, otherwise the page would not have loaded at all ("Calling a function on an non-object"). However, what you can see is that the two section below "NUESTRAS FORTALEZAS" and "SUS VENTAJAS" that get their content from repeaters, don't show any content, either.

The fact that the issue only occurs on the production server indicates that some permissions are off, but I already checked every file, and to the best of my knowledge everything is fine. 

EDIT: Even if there was a problem with the file permissions, it should not matter in this case, as the content for repeaters lives in the database and is not stored as an asset in the file system. At least this is how I understand it.

The Spanish version of the site will be ready in a few days, but it won't provide a good user experience with the repeaters not showing.

I have been struggling with this issue for almost a month now, and also posted it here (1), but I still haven't found any solution. I therefore would be very grateful if anyone could give me a hint or point me into the right direction. 

Cheers, 

Stefan

(1) www.processwire.com/talk/topic/11300-problem-with-repeater-fields-in-multi-language-pages/

Link to comment
Share on other sites

Php issue? Search for max execution time, memory limit, etc on pw forums (use Google search for better results). If it worked locally there could be something with the environment. How did you move the site live?

Link to comment
Share on other sites

After logging in to the admin and reloading the page, one repeater element (out of 3) under the headline  "NUESTRAS FORTALEZAS" is now displayed. But the content of the other repeaters still does not appear. And I have no clue how this single repeater element suddenly appeared on the page.  

I extended the execution time of the home template with 

set_time_limit(600);

but this did not did the trick, either. Nor did flushing the cache. 

This is the PHP info file from my hosting provider: http://phpinfo.he-webpack.de/phpinfo.php

I uploaded the database via PHPMyAdmin and the content through the upload site of my hosting provider. 

Cheers, 

Stefan

Link to comment
Share on other sites

I'm no server guru so I can only recommend trying out different PHP settings, see

 
Have you tried disabling the cache entirely? Additionally, are you sure there's no other cache besides PW's?
 
I guess you have made sure the slides in other languages are Active (I suggested that in the corresponding topic you linked).
 
I think the migration was OK so I currently have no other idea what can be wrong.
Link to comment
Share on other sites

Thanks for your additional ideas.

I looked at the forum pages you linked to, but I don't think this is the issue here. The image in question is about 350kb and is displayed just fine on the English homepage (just not on the Spanish one). This same is true for the other repeaters.

I flushed ProCache's cache but that did not have any effect on the issue. I am not aware of any other cache. Also, all updates to all other pages did appear without problems.

I know how to set the language of a page to 'active', but I haven't heard of a similar setting for repeaters. So I guess I am back at square one for now. 

Cheers, 

Stefan

Link to comment
Share on other sites

I just updated my site to PHP version 5.6, the newest version available with my hosting provider: http://www.sovonex.com/phpinfo/

Unfortunately, still no repeaters (except for 1 element of 1 repeater) are displayed on the homepage of the Spanish version: http://www.sovonex.com/es/

Is there anything else left to check?

Cheers, 

Stefan

Link to comment
Share on other sites

I know how to set the language of a page to 'active', but I haven't heard of a similar setting for repeaters

It's the home page itself but I guess it's active, otherwise you would get more errors.

Would it be hard to replace the repeater with pagetable?

Link to comment
Share on other sites

@LostKobrakai

Please find below the code for all three repeater sections, together with some additional explanations.

Section: Hero Image

==============================================

Partial home-large-image.php (gets included by template home.php)

$img = $page->slides->first()->image;

slides: Repeater with a single Image field ('image')

Note: Throw the error "Calling a function on an non-object"

Section: OUR STRENGTHS / NUESTRAS FORTALEZAS

==============================================

Template home.php

<?php foreach ($page->portfolio as $p): ?>
            <?php echo $p->render(); ?>
<?php endforeach; ?>
 
Template repeater_services.php (Template of repeater portfolio)
<div class="col-md-4 col portfolio-item">
  <div class="icon-border"> <i class="glyphicon <?= $page->icon ?>"></i> </div>
  <!-- <h3 class="upper colored"><?= $page->subject ?></h3> -->
  <h3 class="upper colored"><a href="<?= $page->page->url ?>" ><?= $page->subject ?></a></h3>
  <?= $page->summary ?>
    <?php

  $linkText = __("Main page");
  echo "<a class='go-to-link' href='{$page->page->url}'>{$linkText} <i class='glyphicon glyphicon-new-window'></i></a>";

  ?>
</div>
portfolio: Repeater with the following fields
-- TextLanguage ('subject')
-- TextareaLanguage ('summary')
-- Page ('page')
-- Text ('icon')

Note: This repeater is supposed to display three repeater items. Today a single one suddenly appeared (the second one of the three).

Section: YOUR ADVANTAGES / SUS VENTAJAS

==============================================

Template home.php

<?php 
            foreach($page->all_advantages as $advantage) {
              echo $advantage->render();
            }
?>
 
Template repeater_competitive_advantages.php (Template of repeater all_advantages)
<div class="<?= evenOddTimeline() ?>">
    <div class="icon-border"> 
    </div>
    <h5 class="upper"><?= $page->subject ?></h5>
    <?= $page->summary ?> 
</div>
all_advantages: Repeater with two fields
-- TextLanguage ('subject')
-- TextareaLanguage ('summary')
 
Note: This repeater is supposed to display five repeater items, however, none is displayed.
 
Final note: All three repeaters work properly on the English version (default language) of the home page, but not on the Spanish version.
 
Cheers, 
 
Stefan
Link to comment
Share on other sites

As it turned out, the issue was with the database. For every repeater item, I deleted the translated text, saved the page, re-entered the text and saved the page again. After that the text magically appeared on the page. 

I also removed the repeater at the top and replaced it with a simple image field.

In summary, I was able to solve the issue, but I still don't know what caused it in the first place. 

Cheers, 

Stefan

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...