Hi guys,
my project view does not work as i want. i’d like to fetch my projects in a grid system like in this example:
here is the code snippet:
<?php
// grab your projects
$projects = page('projects')->children()->visible();
$count = 0; foreach ($projects as $project) : ?>
<?php if($count % 3 < 1): ?>
<div class="row columns columns-1">
<div class="column column--no-padding">
<div style="text-align: center;">
<div style="width:49.99%; display:inline-block;padding:0 15px;">
<a href="<?php echo $project->url() ?>">
<h2><?php echo $project->title()->html() ?></h2>
<?php
$i = 0;
$datasrc = '';
// loop through the images
// result is a comma separated list of the srcs
foreach($project->images()->shuffle()->limit(5) as $image) {
if ($i == 0) {
$datasrc .= $image->url();
} else {
$datasrc .= ',' . $image->url();
}
$i++;
}
?>
<div class="img--container">
<img class="img--hover" src="<?php echo $project->images()->first()->url() ?>" alt="<?php echo $project->title()->html() ?>" data-src="<?php echo $datasrc ?>" data-index="0">
</div>
</a>
<div>
<span><?php echo $project->images()->count() ?> Images</span>
</div>
</div>
</div>
</div>
</div>
<?php else: ?>
<div>
<div class="columns-2">
<div class="column">
<a href="<?php echo $project->url() ?>">
<h2><?php echo $project->title()->html() ?></h2>
<?php
$i = 0;
$datasrc = '';
// loop through the images
// result is a comma separated list of the srcs
foreach($project->images()->shuffle()->limit(5) as $image) {
if ($i == 0) {
$datasrc .= $image->url();
} else {
$datasrc .= ',' . $image->url();
}
$i++;
}
?>
<div class="img--container">
<img class="img--hover" src="<?php echo $project->images()->first()->url() ?>" alt="<?php echo $project->title()->html() ?>" data-src="<?php echo $datasrc ?>" data-index="0">
</div>
</a>
<div>
<span><?php echo $project->images()->count() ?> Images</span>
</div>
</div>
</div>
<?php endif; ?>
<?php $count++; endforeach ?>
Maybe you have an idea?
Would be great to have a hint how to align the headlines on top of the images as well
Thanx in advance