Hey all,
I apologize if this question has been asked before. I dug around and didn’t find a topic that seemed to answer my particular question.
Background: I am build a site for a law firm. They want to showcase their cases on their site, and display their wins and losses on a page within two different content wells.
I’ve approach this by making a custom field in the cms, which has radio options for ‘won’ and ‘lost’.
My question is: can I use filterBy to gather all of the wins in one area of the page, and losses in another? Right now my code looks like this, but of course it doesn’t work.
<?php $caseList = yaml($page->caseList()) ?>
<?php foreach($caseList->filterBy('caseresult','won') as $case): ?>
<h1><?php echo $case['casetitle'] ?></h1>
<?php endforeach ?>
Additionally, I’m wondering if Kirby has a method of counting a total number based on the chosen option, so I can dynamically display their % of wins. eg: 70% won