Jump to content

taotoo

Members
  • Posts

    83
  • Joined

Everything posted by taotoo

  1. Thanks for this - looks neater than what I came up with - I'm sure I can learn from it.
  2. Thanks - unfortunately it's still not working though. I actually managed to do it in PHP, but I thought Twig might be easier to learn. This works fine: <?php foreach($page->exhibition_artist as $a) { echo "$a->title"; /*Get works whose work_exhibition field points to the current last segment and work_artist field points to the given artist*/ $wor = $pages->find("template=work, work_exhibition=[{$page->path}], work_artist=[$a]"); /*Render works*/ foreach ($wor as $w) { foreach($w->work_image as $image) { echo "&nbsp;&nbsp;<img src='$image->url' width='200'>"; } /*Render artists*/ echo "{$w->title}"; } } ?>
  3. I'm a beginner and was wondering why the code below isn't working. The issue is where ARTIST (capitalised) appears in the code for the second time. I want it to take the value from the first mention of ARTIST, but it's not doing anything. If I replace the second instance with the name of an artist, then it displays as expected. Hopefully I'm making a basic error! <!--Show artists that are related to current exhibition--> {% set ARTIST = page.exhibition_artist %} {% for artist in artist %} {{ artist.title }} <!--Show works that are related to current exhibition and belong to a given artist--> {% set work = pages.find("template=work, work_exhibition=[page.path], work_artist=[ARTIST]") %} {% for work in work %} {{ work.title }} {% endfor %} {% endfor %}
×
×
  • Create New...