Jump to content

Recommended Posts

Posted

Hi All,

I'm still learning PW, and loving it. But, I'm no PHP coder. 

My Problem is how to output fields from another page inside a repeater.

<?php $showcase = $pages->find("template=work_details") ?>
<?php foreach($showcase as $showcases): ?>
  <div>
    <p class="pb-2 text-left"><?= $showcases->work_hero_subheading ?></p> // This is inside a repeater called "work_hero_repeater"
    </div>
<?php endforeach; ?>

But there is no output.

 

Thank you for any help.

Posted

Hi @Edward Ver

Welcome to the forum and the world of ProcessWire.

Please try the following code. Please note the comments to see if you get the idea.

<?php $showcase = $pages->find("template=work_details") ?>
<?php foreach($showcase as $showcases): ?>
  <div>
    <?php foreach($showcases->work_hero_repeater as $whr): ?> // You need to loop therough the repeater because repeater is an arrray.
    <p class="pb-2 text-left"><?= $whr->work_hero_subheading ?></p> // Then call the field in the repeater item as you need"
    <?php endforeach; ?>
    </div>
<?php endforeach; ?>

Gideon

  • Like 1

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
  • Recently Browsing   0 members

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