PHP (Kirby): redirect gallery to subfolder -


hi i've been working kirby. i'm complete beginner in php managed lot done. need gallery.

on homepage single image displayed thumbnail:

<?php foreach($articles $article): ?>     <li class="<?php foreach(str::split($article->tags()) $tag): ?><?php echo $tag ?> <?php endforeach ?>">     <a href="<?php echo $article->url() ?>" title="<?php echo html($article->title()) ?>"><?php foreach($article->images() $image): ?><?php echo thumb($image, array('width' => 300, 'quality' => 70)) ?><?php endforeach ?><p><?php echo html($article->title()) ?></p></a>     </li>              <?php endforeach ?>   

on article page i'd have gallery. gallery snippet:

<?php if($page->hasimages()): ?>     <ul class="gallery">         <?php foreach($page->images() $image): ?>            <li>            <a href="<?php echo $image->url() ?>"><img src="<?php echo $image->url() ?>" width="<?php echo $image->width() ?>" height="<?php echo $image->height() ?>" alt="<?php echo $image->name() ?>" /></a>             </li>         <?php endforeach ?>     </ul> <?php endif ?> 

using kirby, makes me store article items in 1 folder. if this, , use code mentioned above, images gallery show thumbnails on homepage. guess best edit gallery snippet can grab images subfolder. how?

thank help!

one solution name file wanna have displayed on front page front.jpg. can directly access image $page->images()->find('front.jpg').

so this:

<?php foreach($articles $article): ?>   <li class="<?php foreach(str::split($article->tags()) $tag): ?><?php echo $tag ?> <?php endforeach ?>">   <a href="<?php echo $article->url() ?>" title="<?php echo html($article->title()) ?>">     <?php echo thumb($article->images()->find('front.jpg'), array('width' => 300, 'quality' => 70)) ?>     <p><?php echo html($article->title()) ?></p>   </a>   </li>              <?php endforeach ?> 

(note, have remove inner foreach-loop, because you're displaying 1 image.)

the gallery snippet stays same.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -