home > controller : shuffle slides + déplacer logique depuis template
All checks were successful
Deploy / Deploy to Production (push) Successful in 3s
All checks were successful
Deploy / Deploy to Production (push) Successful in 3s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
06fc040f80
commit
5d6fa47606
6 changed files with 102 additions and 80 deletions
|
|
@ -1,29 +1,6 @@
|
|||
<?php snippet('header') ?>
|
||||
|
||||
<div id="home-slideshow">
|
||||
<?php
|
||||
$files = $site->slideshow()->toFiles();
|
||||
|
||||
$count = $files->count();
|
||||
$slides = [];
|
||||
$i = 0;
|
||||
|
||||
while ($i < $count) {
|
||||
$file = $files->nth($i);
|
||||
$nextFile = $files->nth($i + 1);
|
||||
|
||||
$isPortrait = $file->type() === 'image' && $file->orientation() === 'portrait';
|
||||
$nextIsPortrait = $nextFile && $nextFile->type() === 'image' && $nextFile->orientation() === 'portrait';
|
||||
|
||||
if ($isPortrait && $nextIsPortrait) {
|
||||
$slides[] = ['pair' => true, 'a' => $file, 'b' => $nextFile];
|
||||
$i += 2;
|
||||
} else {
|
||||
$slides[] = ['pair' => false, 'file' => $file];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php foreach ($slides as $slide): ?>
|
||||
<?php if ($slide['pair']): ?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue