bytesource Posted December 20, 2015 Share Posted December 20, 2015 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 More sharing options...
bytesource Posted December 21, 2015 Author Share Posted December 21, 2015 Does anybody have any idea what might be causing the issue here? The real problem for me is that I don't know where to look at next. Cheers, Stefan Link to comment Share on other sites More sharing options...
tpr Posted December 21, 2015 Share Posted December 21, 2015 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 More sharing options...
bytesource Posted December 22, 2015 Author Share Posted December 22, 2015 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 More sharing options...
tpr Posted December 22, 2015 Share Posted December 22, 2015 I'm no server guru so I can only recommend trying out different PHP settings, see https://processwire.com/talk/topic/2190-max-file-size-for-uploading-a-file/ https://processwire.com/talk/topic/4031-maximum-nesting-level-reached-at-each-edit-in-backend/ 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 More sharing options...
bytesource Posted December 22, 2015 Author Share Posted December 22, 2015 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 More sharing options...
bytesource Posted December 22, 2015 Author Share Posted December 22, 2015 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 More sharing options...
tpr Posted December 22, 2015 Share Posted December 22, 2015 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 More sharing options...
bytesource Posted December 22, 2015 Author Share Posted December 22, 2015 Replacing the repeaters with pagetables would be possible, but that would only be my last choice. I was just hoping that I would be able to find the reason for this weird behavior. Cheers, Stefan Link to comment Share on other sites More sharing options...
tpr Posted December 22, 2015 Share Posted December 22, 2015 Have you tried querying the $page in other ways? E.g. $slidesPage = wire('pages')->find(...). I'm not sure if this makes any sense but I'm left out of ideas Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 22, 2015 Share Posted December 22, 2015 Getting the "Calling a function on an non-object" error would suggest, that any of those objects is not what it should be: $page, $page->slides, $repeateritem->image. Which one is the one that's not returning the data it should? Link to comment Share on other sites More sharing options...
bytesource Posted December 22, 2015 Author Share Posted December 22, 2015 @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 More sharing options...
bytesource Posted December 30, 2015 Author Share Posted December 30, 2015 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now