Any post type can be featured now
Automatic generator still searches only for images though.
This commit is contained in:
parent
676c3a41e2
commit
618f9e3d77
3 changed files with 27 additions and 14 deletions
|
@ -7,9 +7,9 @@
|
|||
|
||||
<?php if (!empty($this->context->featuredPost)): ?>
|
||||
<div class="body">
|
||||
<a href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->featuredPost->id]) ?>">
|
||||
<img title="Featured image" src="<?php echo \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $this->context->featuredPost->name]) ?>" alt="<?php echo $this->context->featuredPost->name ?>"/>
|
||||
</a>
|
||||
<?php $this->context->imageLink = \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->featuredPost->id]) ?>
|
||||
<?php $this->context->transport->post = $this->context->featuredPost ?>
|
||||
<?php echo $this->renderFile('post-file-render') ?>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
|
23
src/Views/post-file-render.phtml
Normal file
23
src/Views/post-file-render.phtml
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php $post = $this->context->transport->post ?>
|
||||
|
||||
<?php if ($post->type == PostType::Image): ?>
|
||||
|
||||
<?php if (!empty($this->context->imageLink)): ?>
|
||||
<a href="<?php echo $this->context->imageLink ?>">
|
||||
<?php endif ?>
|
||||
|
||||
<img src="<?php echo \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $post->name]) ?>" alt="<?php echo $post->name ?>"/>
|
||||
|
||||
<?php if (!empty($this->context->imageLink)): ?>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
|
||||
<?php elseif ($post->type == PostType::Flash): ?>
|
||||
|
||||
<embed width="<?php echo $post->image_width ?>" height="<?php echo $post->image_height ?>" type="application/x-shockwave-flash" src="<?php echo \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $post->name]) ?>"/>
|
||||
|
||||
<?php elseif ($post->type == PostType::Youtube): ?>
|
||||
|
||||
<iframe width="800" height="600" src="//www.youtube.com/embed/<?php echo $post->orig_name ?>" frameborder="0" allowfullscreen></iframe>
|
||||
|
||||
<?php endif ?>
|
|
@ -276,17 +276,7 @@
|
|||
|
||||
<div id="inner-content">
|
||||
<div class="post-wrapper post-type-<?php echo strtolower(PostType::toString($this->context->transport->post->type)) ?>">
|
||||
<?php switch ($this->context->transport->post->type):
|
||||
case PostType::Image: ?>
|
||||
<img src="<?php echo \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $this->context->transport->post->name]) ?>" alt="<?php echo $this->context->transport->post->name ?>"/>
|
||||
<?php break ?>
|
||||
<?php case PostType::Flash: ?>
|
||||
<embed width="<?php echo $this->context->transport->post->image_width ?>" height="<?php echo $this->context->transport->post->image_height ?>" type="application/x-shockwave-flash" src="<?php echo \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $this->context->transport->post->name]) ?>"/>
|
||||
<?php break ?>
|
||||
<?php case PostType::Youtube: ?>
|
||||
<iframe width="800" height="600" src="//www.youtube.com/embed/<?php echo $this->context->transport->post->orig_name ?>" frameborder="0" allowfullscreen></iframe>
|
||||
<?php break ?>
|
||||
<?php endswitch ?>
|
||||
<?php echo $this->renderFile('post-file-render') ?>
|
||||
</div>
|
||||
|
||||
<?php if ($canEditAnything): ?>
|
||||
|
|
Loading…
Reference in a new issue