As the title says, I’m would like to use the one pager to create something akin to slider of divs that horizontally scroll. I would like the each page to use the same snippet piece.php and for content to appear on the home page. Currently I’m getting the error “Call to a member function uid() on string”. How can I about fixing this?
Any help would be greatly appreciated.
home.php template
<?php
$pieces = page('work')
?>
<div id="wrapper">
<?php snippet('nav') ?>
<div class="content" data-page="<?= $page->uid() ?>">
<div id="work">
<?php
foreach($pieces->visible() as $section) {
snippet($section->uid(), array('data' => $section));
}
?>
</div>
</div>
</div>
piece.php snippet
<?php $num = 0; foreach($data->thumbnails()->yaml() as $image): $num++; ?>
<?php if($image = $data->image($image)): ?>
<div class="piece-cnt">
<a href="<?= $data->url(); ?>" id="<?= $data->uid() ?>" num="<?= $num ?>" class="piece" data-slug="<?php echo str::slug($data->title())?>">
<img src="<?php echo imgix($image, array('w' => 300)) ?>" />
</a>
</div>
<?php endif ?>
<?php endforeach ?>