Skip to content

Instantly share code, notes, and snippets.

@niklausgerber
Last active December 17, 2015 14:48
Show Gist options
  • Save niklausgerber/5626584 to your computer and use it in GitHub Desktop.
Save niklausgerber/5626584 to your computer and use it in GitHub Desktop.
Problem with my footer
<?php $article = $pages->find('blog')->children()->last() ?>
<?php $second = $article->prev() ?>
<?php $third = $second->prev() ?>
<div class="footer">
<div class="container">
<div class="grid full">
<h3><?php echo html($article->title()) ?></h3>
<small><?php echo html($article->Published()) ?></small>
<p><?php echo excerpt($article->text(), 400) ?><a href="<?php echo html($article->url()) ?>"> Continue reading</a></p>
</div>
<div class="cf"></div>
<hr />
<?php if($page->template()!='article') :?>
<div id="next" class="grid half">
<p><a href="<?php echo html($second->url()) ?>"><?php echo html($second->title()) ?><br /><small><?php echo excerpt($second->description(), 60) ?></small></a></p>
</div>
<?php elseif($page->template()=='article' and $page->hasNext()) :?>
<div id="next" class="grid half">
<p><a href="<?php echo $page->next()->url() ?>"><?php echo $page->next()->title() ?><br /><small><?php echo excerpt($page->next()->description(), 60) ?></small></a></p>
</div>
<?php else : ?>
<div id="next" class="grid half">
&nbsp;
</div>
<?php endif ?>
<?php if($page->template()!='article') :?>
<div id="previous" class="grid half">
<p><a href="<?php echo html($third->url()) ?>"><?php echo html($third->title()) ?><br /><small><?php echo excerpt($third->description(), 60) ?></small></a></p>
</div>
<?php elseif($page->template()=='article' and $page->hasPrev()) :?>
<div id="previous" class="grid half">
<p><a href="<?php echo $page->prev()->url() ?>"><?php echo $page->prev()->title() ?><br /><small><?php echo excerpt($page->prev()->description(), 60) ?></small></a></p>
</div>
<?php else : ?>
<div id="next" class="grid half">
&nbsp;
</div>
<?php endif ?>
<div class="cf"></div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment