How to get the title of a list field?

Hi my team.yml pages is…


and member.yml is…

I want to get the title of “member” list in member.yml to "team"template… but even using “toPages”
nothing happend…

in member template, I can load that list with this code:

<?php 
    $listPages = $page->works()->toPages();
?>

but in team page… not working… how can I fix this…?

I don’t really understand. Please post the relevant code you are using in your team template.

<?php snippet('header') ?>

<main class="wrapper">
  <div class="team-top">
    <h1><?= $page->subtitle() ?></h1><br>
    <?= $page->description() ?><br>
  </div>

  <div class="swiper mySwiper">
        <div class="swiper-pagination"></div>
        <div class="swiper-wrapper">            
            <?php foreach ($page->children()->listed() as $team): ?>
            <div class="swiper-slide">
                <a href="<?= $team->url() ?>">
                <h1><?= $team->name() ?></h1>
                <?= $team->position() ?>ㅤ<br>
                <?= $team->role() ?>ㅤ<br><br><br>

                <div class="swiper-sign">
                <?php if ($memberSign = $team->sign()->toFile()): ?>
                    <img src="<?= $memberSign->url() ?>">
                <?php endif ?>
                </div><br>

                <div class="swiper-hide">
                <?php if ($memberList = $team->works()->toPages()): ?>
                    <?= $memberSign->title() ?>
                <?php endif ?>
                </div>

                </a>
            </div>
            <?php endforeach ?>
        </div>
    </div>
</main>

here…

This is the problematic code. Apart from this being impossible to work, you should really keep an eye on your variable names ($memberList vs $memberSign)

Should be

<?php 
// fetch the field values into a pages collection
$memberList = $team->works()->toPages(); ?>
<!-- then loop through the collection -->
<?php if ($memberList->isNotEmpty(): ?>
  <?php foreach ($memberList as $work): ?>
    <!-- code here for each item, e.g. -->
    <?= $work->title() ?>
  <?php endforeach ?>
<?php endif ?>