heimrichhannot / contao-news_related_plus
为新闻列表模块添加对 contao-legacy/news_related 的支持
1.1.2
2020-05-15 12:45 UTC
Requires
- php: ~5.4 || ~7.0
- contao-community-alliance/composer-plugin: ~2.4 || ~3.0
- contao-legacy/news_related: ~3.5
- contao/core-bundle: ^3.5.1 || ~4.1
README
为新闻列表模块添加对 contao-legacy/news_related
的支持
技术说明
如 <contao-legacy/news_related>/templates/modules/mod_newsreader.html5
所示,将以下代码片段添加到您的 news_latest.html5
模板中
<?php if ($this->newsRelated): ?>
<div class="news_related block">
<div class="related_headline"><h2><?php echo $this->related_headline; ?></h2></div>
<div class="related_content">
<div class="related_info"><?php echo $this->info; ?></div>
<div class="related_items block">
<?php foreach ($this->newsRelated as $related): ?>
<div class="related_item block">
<?php if ($related['image']): ?>
<figure class="image_container">
<?php if ($related['url']): ?>
<a href="<?php echo $related['url']; ?>" title="<?php echo $related['image']['alt']; ?>" rel="lightbox">
<?php endif; ?>
<?php $this->insert('picture_default', $related['image']['picture']); ?>
<?php if ($related['url']): ?>
</a>
<?php endif; ?>
</figure>
<?php endif; ?>
<p class="info">
<time
datetime="<?php echo $related['datetime']; ?>"><?php echo $related['date']; ?></time> <?php echo $related['commentCount']; ?>
</p>
<div class="item_headline"><h3><a href="<?php echo $related['url']; ?>"
title="<?php echo $related['title']; ?>"><?php echo $related['headline']; ?></a></h3></div>
<div class="item_teaser"><?php echo $related['teaser']; ?> <span class="more"><?php echo $related['more']; ?></span></div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>