# Kirby Gallery Plugin issue

**URL:** <https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873>\
**Category:** Questions\
**Tags:** v2\
**Created:** [December 25, 2018, 1:00pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873 "2018-12-25T13:00:12Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 25, 2018, 1:00pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/1 "2018-12-25T13:00:12Z")

</div>

Hi, guys, I am a tester, so I am rookie

i want to install kirby gallery plugin. I create fields folder than i moved gallery folder in it. i add blueprints in article.yml.

in panel side everything is perfect. i am able to upload pictures, select pictures quickly everything.

but in site side gallery is not showing

can you help me

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 25, 2018, 11:55pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/2 "2018-12-25T23:55:38Z")

</div>

Could you post your code from the article.php template where you are trying to fetch the images from the gallery field?

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 8:30am UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/3 "2018-12-26T08:30:02Z")

</div>

Hi, thank you for your reply;

site/templates/article.php

```
<?php snippet('header') ?>

<main class="main" role="main">

    <div class="container">

        <?php if($site->articleLayout() == 'design1'): ?>

            <?php snippet('article/layoutDefault') ?>

        <?php else: ?>

            <?php snippet('article/layoutModern') ?>

        <?php endif ?>

    </div>

</main>

<?php snippet('footer') ?>

```

this is site/snippets/article/layoutDefault.php

```
<div class="row">
    <div class="col-12 col-md-9">
        <article class="mb-5">
            <?php if($img = $page->coverimage()->toFile()): ?>
            <a href="<?= $img->url() ?>" data-toggle="lightbox">
                <img class="img-fluid rounded mb-4" src="<?= $img->crop(825,516)->url() ?>" alt="<?= $img->alt() ?>">
            </a>
            <?php endif ?>
            <h1 class="h2"><?= $page->title() ?></h1>
            <?= $page->text()->kirbytext() ?>
        </article>
        <!-- Show articles tags -->
        <?php snippet('article/tags') ?>
        <hr>
        <!-- Show author -->
        <?php snippet('article/author') ?>
     	<hr>
        <!-- Show related articles -->
        <?php snippet('article/relatedArticles') ?>
    </div>
    <div class="col-12 col-md-3">
        <aside>
            <!-- Call aside modules -->
            <?php snippet('aside/socialbar') ?>
            <?php snippet('aside/about') ?>
            <?php snippet('aside/categories') ?>
            <?php snippet('aside/popularPosts') ?>
            <?php snippet('aside/tags') ?>
        </aside>
    </div>
</div>

```

and i want to show gallery in other page which is called default page  
site/templates/Default.php

```
<?php snippet('header') ?>

<main class="main" role="main">
    <div class="container">
        <div class="row mt-4 justify-content-center">
            <div class="col-12 col-md-9">
                <h1 class="h2 mb-5"><?= $page->title() ?></h1>
                <?= $page->text()->kirbytext() ?>
            </div>
            <?php if($site->defaultLayout() == 'show'): ?>
            <div class="col-12 col-md-3">
                <aside>
                <!-- Call aside modules -->
                <?php snippet('aside/socialbar') ?>
                <?php snippet('aside/about') ?>
                <?php snippet('aside/categories') ?>
                <?php snippet('aside/popularPosts') ?>
                <?php snippet('aside/tags') ?>
                </aside>
            </div>
            <?php endif ?>
        </div>
    </div>
</main>

<?php snippet('footer') ?>
```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 26, 2018, 10:07am UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/4 "2018-12-26T10:07:33Z")

</div>

To get this right:

You don’t want to show the gallery in the article.php template, but in the default.php template? All galleries of all articles? The gallery of a single article? All images of all articles as a single gallery?

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 11:47am UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/5 "2018-12-26T11:47:02Z")

</div>

Actually, i have 2 different article page. The first one is blog’s article page and the other one is default page so

I want to show gallery which is specific single gallery about per article,

Example :lets say if i write about nature, in the panel side i add pictures about nature and it should be shown in the gallery panel, or if i write about a city the gallery should show pictures I have already added regarding that city.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 26, 2018, 12:26pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/6 "2018-12-26T12:26:53Z")

</div>

You can fetch the files from the field like so:

```auto
<?php

$gallery = $page->fieldname()->yaml(); // replace" fieldname" with name of your field

foreach($gallery as $imageName):

  if($image = $page->image($imageName)): ?>
    <img src="<?= $image->url() ?>">
  <?php endif ?>
<?php endforeach ?>

```

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 12:41pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/7 "2018-12-26T12:41:45Z")

</div>

thank you for solution sorry i am so rookie

which files in my template files or in gallery plugin files  
🤗

i added this code in article page but nothing changed

```auto
<?php

$gallery = $page->gallery()->yaml(); // replace" fieldname" with name of your field

foreach($gallery as $imageName):

  if($image = $page->image($imageName)): ?>
    <img src="<?= $image->url() ?>">
  <?php endif ?>
<?php endforeach ?>

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 26, 2018, 12:54pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/8 "2018-12-26T12:54:35Z")

</div>

You would have to put that code into your templates, either article.php template or default.php template (or both)

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 12:55pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/9 "2018-12-26T12:55:25Z")

</div>

thank you for your patience

but i added code and nothings changed?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 26, 2018, 12:56pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/10 "2018-12-26T12:56:39Z")

</div>

I think I need more information. The easiest would be if you zip the project and send me a PM with a link, if you want.

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 12:57pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/11 "2018-12-26T12:57:33Z")

</div>

thank you i send an email (info)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 26, 2018, 1:34pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/12 "2018-12-26T13:34:27Z")

</div>

Ok, two issues:

- In the code that you added to your default.php template, you call the field gallery, but the name of the field in your blueprint is `pictures`, so it must read:

![11](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/0/05cfc54ef83df71a3314fee9883c1d32f525acdf.jpeg)

```auto
<?php

$gallery = $page->pictures()->yaml(); // replace" fieldname" with name of your field

foreach($gallery as $imageName):

  if($image = $page->image($imageName)): ?>
    <img src="<?= $image->url() ?>">
  <?php endif ?>
<?php endforeach ?>

```

- Secondly, you put the code into the `default.php`template, but all your articles use the `articles.php` template (i.e. all subpages of the blog folder have an article.txt file in it and that means that the content is rendered with the template of the same name). If you put the above code into your `article.php` template, the files should show up in the “Life is a journey” article (the other two don’t have any pictures saved yet):

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 1:37pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/13 "2018-12-26T13:37:02Z")

</div>

thank you for your interest firstly

secondly i think i will buy a personal licences. İs there any christmas discount about future 🙂

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 26, 2018, 1:39pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/14 "2018-12-26T13:39:44Z")

</div>

No, currently there are no discounts at all available (there are no discounts for the personal license, anyway).

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 1:39pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/15 "2018-12-26T13:39:44Z")

</div>

![Ekran%20Al%C4%B1nt%C4%B1s%C4%B1](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/2/264da9f0bbb8d6103c0bbd82eff5df15bc55db2b.png)

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 1:43pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/16 "2018-12-26T13:43:32Z")

</div>

ok i got it thank you

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 26, 2018, 1:43pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/17 "2018-12-26T13:43:55Z")

</div>

The code looks a bit messy, there seems to be a space missing between the opening php tag and the `$gallery` variable. Your code should look something like this (depending on where you want your images to show up)

```auto
<?php snippet('header') ?>
<?php 
$gallery = $page->pictures()->yaml();

foreach($gallery as $imageName):

  if($image = $page->image($imageName)): ?>
    <img src="<?= $image->url() ?>">
  <?php endif ?>
<?php endforeach ?>

<main class="main" role="main">
    <div class="container">
        <?php if($site->articleLayout() == 'design1'): ?>
            <?php snippet('article/layoutDefault') ?>
        <?php else: ?>
            <?php snippet('article/layoutModern') ?>
        <?php endif ?>
    </div>
</main>

<?php snippet('footer') ?>

```

Note that your images will turn up big in the browser, you would have to add some more HTML Markup to make it look nice.

---

<div class="post-metadata">

**Author:** ![heqtor](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/heqtor/32/5917_2.png) [@heqtor](https://forum.getkirby.com/u/heqtor)\
**Post date:** [December 26, 2018, 1:44pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/18 "2018-12-26T13:44:33Z")

</div>

> [@texnixe](#):
>
> \<?php snippet(‘header’) ?\> \<?php $gallery = $page-\>pictures()-\>yaml(); foreach($gallery as $imageName): if($image = $page-\>image($imageName)): ?\> \<img src=“\<?= $image-\>url() ?\>”\> \<?php endif ?\> \<?php endforeach ?\> \<main class=“main” role=“main”\> \<div class=“container”\> \<?php if($site-\>articleLayout() == ‘design1’): ?\> \<?php snippet(‘article/layoutDefault’) ?\> \<?php else: ?\> \<?php snippet(‘article/layoutModern’) ?\> \<?php endif ?\> \</div\> \</main\> \<?php snippet(‘footer’) ?\>

wooow what a support. thankyou

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:25pm UTC](https://forum.getkirby.com/t/kirby-gallery-plugin-issue/11873/19 "2025-02-06T17:25:34Z")

</div>


