Search the Community
Showing results for tags 'checkbox if else'.
-
Hi everyone I have a problem to solve here and I can't get it to work. Kinda new to php and processwire. This is what I want to do: It's some kind of shop. Article with fields (Title, image, description, price and article_reserved checkbox). I need a foreach line and an if else statement in it. This is the foreach line: <?php foreach ($pages->get('/shop/')->children() as $article): ?> <table class="col-xs-5 col-sm-5 col-md-3 col-lg-3"> <tr> <th class="item"><?php echo $article->title;?></th> </tr> <tr> <td class="item"><a href=""><img class="article-image" src="<?php echo $article->article_image->url; ?>"></a></td> <td class="item"><?php echo $article->article_description; ?></td> <td class="item">Size: <?php echo $article->article_size; ?></td> <td class="item">Price CHF: <?php echo $article->article_price; ?></td> <td class="button"><button type="button" class="btn btn-primary btn-sm">Order</button></td> </table> <?php endforeach; ?> When the article is checked as "reserved" (field: article_reserved), then there should be a class .reserved added to the image tag. if not, then not. Any ideas? Thanks.