RSS news add anchor

This commit is contained in:
Fred Tempez 2020-11-21 03:57:27 +01:00
parent d20bd6d14f
commit 30c3196460
2 changed files with 3 additions and 3 deletions

View File

@ -70,11 +70,11 @@ class news extends common {
$author = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'userId'])); $author = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'userId']));
$newsArticle->addElementArray([ $newsArticle->addElementArray([
'title' => $this->getData(['module', $this->getUrl(0),'posts', $newsId, 'title']), 'title' => $this->getData(['module', $this->getUrl(0),'posts', $newsId, 'title']),
'link' => helper::baseUrl() . $this->getUrl(0), 'link' => helper::baseUrl() . $this->getUrl(0) . '/' . $newsId . '#' . $newsId,
'description' => $this->getData(['module', $this->getUrl(0),'posts', $newsId, 'content']) 'description' => $this->getData(['module', $this->getUrl(0),'posts', $newsId, 'content'])
]); ]);
$newsArticle->setAuthor($author,'no@mail.com'); $newsArticle->setAuthor($author,'no@mail.com');
$newsArticle->setId(helper::baseUrl() .$this->getUrl(0) . '/' . $newsId); $newsArticle->setId(helper::baseUrl() .$this->getUrl(0) . '/' . $newsId . '#' . $newsId);
$newsArticle->setDate(date('r', $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'publishedOn']))); $newsArticle->setDate(date('r', $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'publishedOn'])));
$feeds->addItem($newsArticle); $feeds->addItem($newsArticle);
} }

View File

@ -2,7 +2,7 @@
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php foreach($module::$news as $newsId => $news): ?> <?php foreach($module::$news as $newsId => $news): ?>
<h1 class="newsTitle"> <h1 class="newsTitle" id="<?php echo $newsId;?>">
<?php echo $news['title']; ?> <?php echo $news['title']; ?>
</h1> </h1>
<div class="newsContent"> <div class="newsContent">